-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
51 lines (45 loc) · 1.04 KB
/
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
44
45
46
47
48
49
50
51
#include <iostream>
using namespace std;
int main(){
string input = "";
int num1 = 0;
int num2 = 0;
int remainder = 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;
remainder = num1%num2;
if (remainder == 0){
cout << endl;
}
else{
cout << " with a remainder of " << remainder << endl;
}
}
}
else if( "quit" ){
cout << "Goodbye!\n";
}
else{
cout << input << " is not a recognized command.\n";
}
return 0;
}