Advertisement
Emulation

Untitled

Oct 4th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. bool Restart = true;
  6.  
  7. while (Restart == true)
  8. {
  9. cout << "Please Enter An Operation: + - * / " << endl;
  10. char Sign;
  11. cin >> Sign;
  12. cout << "Please Enter Number 1: " << endl;
  13. double num1;
  14. cin >> num1;
  15. cout << "Please Enter Number 2: " << endl;
  16. double num2;
  17. cin >> num2;
  18.  
  19. if(Sign == '+')
  20. {
  21. cout << "Your answer is: " << num1 + num2 << endl;
  22. }
  23. if(Sign == '-')
  24. {
  25. cout << "Your answer is: " << num1 - num2 << endl;
  26. }
  27. if(Sign == '/')
  28. {
  29. cout << "Your answer is: " << num1 / num2 << endl;
  30. }
  31. if(Sign == '*')
  32. {
  33. cout << "Your answer is: " << num1 * num2 << endl;
  34. }
  35. cout << "Would you like to do another problem? [Y/N]" << endl;
  36. char answer;
  37. cin >> answer;
  38. if(answer == 'Y')
  39. {
  40. Restart = true;
  41. }
  42. else
  43. if(answer == 'N')
  44. {
  45. Restart = false;
  46. }
  47. }
  48. return 0;
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement