Hi,
I created calculator class which analyze string and calculates formulas in it.
It works good in terminal. But won't work good in GUI.
If I give to class object string like this "1.3+2.5" in terminal,
it gives result 3.8, but if I give it from GUI. It returns 3.
Can't find why. And it occurs in class method.
Program are over 700 line length, so I can't put in this forum, but if some one wants I can make zip file and put in my site.
viliml umm learn something all modern processors have support for floating points. C/C++ has had support for floating points with some degree of accuracy since their inceptions. He is converting something to string and back and most text or numbers have to be converted to strings to be displayed in a gui.
for example:
1 2 3 4 5 6 7 8 9 10 11 12 13
// converting to float from string:
string myString = "3.14159";
stringstream convert;
convert << myString;
double myFloat;
convert >> myFloat;
// converting the float to a string.
double myFloat = 3.14159;
stringstream convert;
convert << myFloat;
string myString;
convert >> myString;
In my function Everything goes well until atof() function.
c_equation have full float number as char array.
cout << c_equation[0] << c_equation[1] << c_equation[2] << endl;
have printed good number (1.3), but after atof(c_equation)
result are 1