so far i already reach this line, but what make it pain in the ass is, i can't really seem to solve how to make multiple operation in one execution, i can only manage make it one operation in time, some say i have to convert the operation like "1.22*3+2.1" into string, so the computer it self take the operation and execute it by priority and also in multiple operation, but what puzzle me is how to exract the value out to determine the result of the calculation?


int main() {

char name[]={};
puts("\n\nCalculate:" ); //prompt user to enter equation
gets( name );

8 Years
Discussion Span
Last Post by watercolour

Begin with the basics of declaring arrays with a meaningful amount of space, and using fgets() to read input.

Then maybe move onto separating numbers from operators.

Then finally proceeding to evaluation.


ya, that is the problem, i don't know why i can't do it, i've try,,, haaaaaa..

could you please show some example with the this "1.2 * 2 - 4"
really need help now,


how to make multiple operation in one execution...
convert the operation like "1.22*3+2.1" into string...
how to exract the value out to determine the result of the calculation?

What does this abracadabra stand for?


actually is a mathematical operation that i want to convert to string and extract it out into result..


What I can understand, is that your are looking for something called Infix to postfix expression. And then solve or evaluate the postfix expression. The postfix expression can be evaluated very easily using a stack machine. Have a go researching on Postfix evaluation algorithm. Thats should probably get you in the right direction.



thank you for the support,
and your right about the solution,
but isn't postfix algorithm are in c++,
i need all the coding purely in c language,

guide me if i'm wrong.. please..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.