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?

#include<stdio.h>
#include<stdlib.h>

int main() {

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

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.

ssharish

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..

thanks alot i'll do my best to keep on track,..:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.