forked from ChicoState/FirstIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (37 loc) · 886 Bytes
/
main.cpp
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
#include <iostream>
using namespace std;
int main(){
string input = "";
int num1 = 0;
int num2 = 0;
cout << "? ";
cin >> input;
if( input == "help" ){
cout << "Hi!\n";
cout << "Options:\nadd\nsubtract\nmultiply\ndivide\nhelp\nquit\n";
}
else if( input == "add" || input == "subtract" || input == "multiply" || input == "divide"){
cout << "First number: ";
cin >> num1;
cin >> num2;
if( input == "add" ){
cout << "=" << num1+num2 << endl;
}
else if( input == "subtract" ){
cout << "=" << num1-num2 << endl;
}
else if( input == "multiply" ){
cout << "=" << num1*num2 << endl;
}
else if( input == "divide" ){
cout << "=" << num1/num2 << endl;
}
}
else if( "quit" ){
cout << "Goodbye!\n";
}
else{
cout << input << " is not a recognized command.\n";
}
return 0;
}