OK, so I have learned so far about getchar/putchar, arrays, varialbes, and control flows. and my homework is writing a program that gets an input from the user and read it char by char. The string has three parts:
it has two non-negative numbers and an operator (*,-,/,+).
I need to read this string and output the result of the given input.
For example, a legal input 3.5+12 will get the output 15.5.
I have to do this without using arrays and scanf function.
Also, I am allowed to assume that the input is legal and that there
is at least one space (' ') between the numbers and the operator.
Okay, now you may ask-- so what is the problem?
Well, everything went fine but for example when I enter: 10.345+10
I get this: 10.345000+10.000000=20.345001.
Another example is: 10.34 + 123.34, gives the output 10.340000+123.340004=133.680008.