You need to input the expression as a string, parse the string (seperate it into the first number, operator, and second number), and then perform that operation on the numbers.<br><br>Inputting the string is simple. When you have it, find the position of the operator in the string, save that character for later. Make two new strings, one with everything before the operator, one with everything after it. Convert those strings to integers (that's simple too, start with 0, add the ascii value of the character minus the ascii value of zero times 10 to the power of how many places from the ones place you are). Then, use a switch statement for the operator, case '+' write num1 + num2, case '*' write num1 * num2, etc. I hope I explained that well enough.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.