Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- bool Restart = true;
- while (Restart == true)
- {
- cout << "Please Enter An Operation: + - * / " << endl;
- char Sign;
- cin >> Sign;
- cout << "Please Enter Number 1: " << endl;
- double num1;
- cin >> num1;
- cout << "Please Enter Number 2: " << endl;
- double num2;
- cin >> num2;
- if(Sign == '+')
- {
- cout << "Your answer is: " << num1 + num2 << endl;
- }
- if(Sign == '-')
- {
- cout << "Your answer is: " << num1 - num2 << endl;
- }
- if(Sign == '/')
- {
- cout << "Your answer is: " << num1 / num2 << endl;
- }
- if(Sign == '*')
- {
- cout << "Your answer is: " << num1 * num2 << endl;
- }
- cout << "Would you like to do another problem? [Y/N]" << endl;
- char answer;
- cin >> answer;
- if(answer == 'Y')
- {
- Restart = true;
- }
- else
- if(answer == 'N')
- {
- Restart = false;
- }
- }
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement