-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (26 loc) · 790 Bytes
/
main.cpp
File metadata and controls
29 lines (26 loc) · 790 Bytes
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
#include <iostream>
using namespace std;
int main() {
int first;
int last;
string type;
cout << "------------------------------------------------------\n";
cout << "Welcome to the calculator\nEnter the first variable:\n";
cin >> first;
cout << "Enter the second variable:\n";
cin >> last;
cout << "Enter the math type e.g. plus, minus, times, divide:\n";
cin >> type;
if (type == "plus") {
cout << "The sum is " << first + last << "!";
} else if (type == "minus") {
cout << "The sum is " << first - last << "!";
} else if (type == "times") {
cout << "The sum is " << first * last << "!";
} else if (type == "divide") {
cout << "The sum is " << first / last << "!";
} else {
cout << "That isn't a valid math type!";
}
return 0;
}