Question: C++ I've successfully created a program that takes a mathematical expression as a string and returns the answer (I used a null terminated character array

C++

I've successfully created a program that takes a mathematical expression as a string and returns the answer (I used a null terminated character array to represent a string). For example if I enter 8*2+4 the result is 20. However I'm having some trouble sorting the mathematical operator priorities. For example, if I enter 5+3*2 then the result would be 16 instead of 11. How can I give priority to multiplication and division?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!