Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. int main()
  2. {
  3. //char statement[100];
  4. int op1, op2;
  5. char operation;
  6. char answer = 'y';
  7.  
  8. while (answer == 'y')
  9. cout << "Enter expression";
  10. cin >> op1;
  11. cin >> operation;
  12. cin >> op2;
  13. if (operation == '+'){
  14. cout << op1 << " + " << op2 << " = " << op1 + op2 << endl;
  15. }
  16. if (operation == '-'){
  17. cout >> op1 << " - " << op2 << " = " << op1 - op2 << endl;
  18. }
  19. if (operation == '*'){
  20. cout << op1 << " * " << op2 << " = " << op1 * op2 << endl;
  21. }
  22. if (operation == '/'){
  23. cout << op1 << " / " << op2 << " = " << op1 / op2 << endl;
  24. }
  25.  
  26. cout << "Do you wish to evaluate another expression? " << endl;
  27. cin >> answer;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement