Changing from variable to another
Nov 19, 2013 at 8:31pm UTC
I am having some trouble, I am trying to change a nominal value to a new value.. I declared the nominal value but later I want to prompt the user to input a new value. but I don't wan to have to re write all my formulas for the nominal value... How do I do this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
double C_NewValue();
double C_NewTolerance();
double C_nominalValue;
double C_tolerance;
Capacitor:: Capacitor(void )
{
C_nominalValue = 100;
C_tolerance = 10;
}
void Capacitor::setCapacitance ()
{
C_nominalValue = C_NewValue;
C_tolerance = C_NewTolerance;
}
... it's telling me that = doesn't convert from double... But I don't know what else to use? I also tried float and int...
Nov 19, 2013 at 8:33pm UTC
C_NewValue and C_NewTolerance are functions, you must call them and assign the results.
Nov 19, 2013 at 10:03pm UTC
I understand that and I haven't got the main I was just trying to figure out my classes...
So When I get my new tolerance I am going to have to change or make all new code for.... because I use C_nominalValue in that equation....
1 2 3 4 5 6
void Capacitor::Calc_Cap()
{
C_minimumValue = C_nominalValue*(1-C_tolerance/100);
C_maximumValue = C_nominalValue*(1+C_tolerance/100);
}
?
Topic archived. No new replies allowed.