I have my code written and just realized that it requires user input for number
ID: 3553943 • Letter: I
Question
I have my code written and just realized that it requires user input for number of resistors to be randomly generated, in other words, the user determines the size of the array. I can not figure out how to get the user input to use the dynamic allocation to set the array size.
***PLEASE WORK WITHIN MY CODE***
Here is my code:
//res.h
class Resistor{
private:
int nominalValue;
int tolerance;
public:
static int counter;
Resistor();
void setNominalValue(bool flag, int temp);
int getNominalValue(bool flag);
int value;
static void incrementCount();
~Resistor();
};
Explanation / Answer
you can use following modifications:
---------------------------------------------------
int size;
cout<<"enter size of array ";
cin>>size;
pntrs=new int[size];