I am writing a calculator program in C. I need a function definition for a function called Subtract() that will allow me to calculate the difference of several numbers entered by the user also need one for division

Recommended Answers

All 4 Replies

That's not so hard.. Have you tried anything yet? Have you learned about functions? Example:

int Substract(int x, int y)
{
    //do something with x and y
    return answer;
}

Niek

Not that easy, I guess you need to parse a complex expression like a+b-c*d and evaluate, you need to learn about binary search tree, and about postorder traversal ,etc.

Not that easy, I guess you need to parse a complex expression like a+b-c*d and evaluate, you need to learn about binary search tree, and about postorder traversal ,etc.

Hey thanks I figured it wouldnt be easy.

Not that easy, I guess you need to parse a complex expression like a+b-c*d and evaluate, you need to learn about binary search tree, and about postorder traversal ,etc.

Not necessarily. If it's just a simple calculator program (as the original poster seems to be implying), then the program itself will likely be no more complex than a simple pocket calculator. Remember, a program only has to be as complex as the requirements state.

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.