Question: Find all the issues within the C++ code and explain with comments how you fixed it. The program should ask for a simple math problem
Find all the issues within the C++ code and explain with comments how you fixed it. The program should ask for a simple math problem to solve and would repeat if the user entered y or Y and terminate if the user entered n or N void main() { char statement[100]; int op1, op2; char operation; char answer="Y" while (answer=='y') { cout << "Enter expression" <> op2 >> operation >> op1; if (operation == "+"); cout << op1 << " + " << op2 >> " = " << op1 + op2 << endl; if (operation == '-'); cout >> op1 << " - " << op2 << " = " << op1 - op2 << endl; if (operation == '*') cout << op1 << " / " << op2 << " = " << op1 * op2 << endl if (operation == '/') cout << op1 << " * " << op2 << " = " << op1 / op2 << endl; cout << "Do you wish to evaluate another expression? " << endl; cin >> answer; } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
