forked from ChicoState/CppMath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (24 loc) · 669 Bytes
/
main.cpp
File metadata and controls
28 lines (24 loc) · 669 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
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main(){
double first, second;
cout<< "First number: ";
cin>> first;
cout<< "Second number: ";
cin>> second;
cout<< "Addition: "<< first << "+" << second << "=";
cout<< (first+second) << endl;
cout<< "Subtraction: "<< first << "-" << second << "=";
cout<< (first-second) << endl;
cout<< "Multiplication: "<< first << "*" << second << "=";
cout<< (first*second) << endl;
if (second != 0) {
cout<< "Division: "<< first << "/" << second << "=";
cout<< (first/second) << endl;
} else {
cout<< "Division: Error - cannot divide by zero!" << endl;
}
return 0;
}