I am making a little physics calculator for fun and I have run into a problem, I have a physics class with member functions to set and get values as well as to check if it possible to solve for an asked for value and if so do it. everything seems to be working fine but my problem is that at some point the proper answer gets replaced with -0.61728. I do initialize everything to -1.23456 so I can check if a value has been input yet but I don't think that should change anything. any help would be greatly appreciated. Oh and it does work correctly with force, mass and acceleration.
class Physics
{
protected:
float acceleration, vel1, vel2, mass, vel_ave, time, distance, force;
public:
/* initialises all variables to -1.23456 a value which
* I hope will never be an answer
*/
Physics();
// self explanitory
void setValue(string name, float value);
// returns the value the user asks for
float getValue(string name);
/* ensures that all the needed values are there and finds
* the asked for value then returns 1 on succes otherwise -1
*/
int calculateValue(string name);
};