-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment6_1.cpp
More file actions
65 lines (35 loc) · 1.23 KB
/
assignment6_1.cpp
File metadata and controls
65 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
using namespace std;
void DisplayMenu() {
cout << "----------------" << endl;
cout << "- 1) Subtract -" << endl; //Originally Add
cout << "- 2) Add -" << endl; //Originally Subtract
cout << "- 3) Divide -" << endl; //Originally Multiply
cout << "- 4) Exit -" << endl;
cout << "----------------" << endl;
}
int main(int argc, char ** argv) {
int choice = 0;
DisplayMenu();
cin >> choice;
while (choice != 4) { //Change 5 to 4 to fit DisplayMenu
int num1, num2;
cout << "Please Enter First Number: " << endl;
cin >> num1;
cout << "Please Enter Second Number: " << endl;
cin >> num2;
if (choice == 1) {
cout << num1 << " - " << num2 << " = " << num1 - num2 << endl;
} else if (choice == 2) {
cout << num1 << " + " << num2 << " = " << num1 + num2 << endl; //Change " - " to " + " to fit output
} else if (choice == 3) {
cout << num1 << " / " << num2 << " = " << (double) num1 / (double) num2 << endl; //Change " - " to " / " to fit output
}
else
{
cout << "ERROR: Please Enter Valid Input" << endl;
}
DisplayMenu();
cin >> choice;
}
}