Question: Hint: This problem is not hard, but can be time consuming since many conditions. Prompt the user to enter a sequence of numbers and arithmetic
Hint: This problem is not hard, but can be time consuming since many conditions. Prompt the user to enter a sequence of numbers and arithmetic symbols as words, and then calculate the result of the equation.
-
Valid number words: zero, one, two, three, four, five, six, seven, eight, nine
-
Valid symbol words: plus, minus, times, divides
-
Order of operation is simply left to right. That is, calculate immediately after reading two numbers and one arithmetic symbol.
-
Use the std::to_string function to convert an int to a string. E.g.,
-
string numberText = std::to_string(9); // string numberText = "9";
-

In c++
Prompt the user to enter a sequence of numbers and arithmetic symbols as words, and then calculate the result of the equation. . Valid number words: zero, one, two, three, four, five, six, seven, eight, nine Valid symbol words: plus, minus, times, divides Order of operation is simply left to right. That is, calculate immediately after reading two numbers and one arithmetic symbol. Use the std::to_string function to convert an int to a string. E.g., o string numberText = std::to_string(9); // string numberText = "9"; Sample Execution Please enter word equation (type 'equals' at the end) : five times two plus four divides seven equals 5 * 2 + 4 / 7 = 2 I Full Screen calculator.cpp + New 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
