Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- //char statement[100];
- int op1, op2;
- char operation;
- char answer = 'y';
- while (answer == 'y')
- cout << "Enter expression";
- cin >> op1;
- cin >> operation;
- cin >> op2;
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement