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
29 lines (23 loc) · 671 Bytes
/
main.cpp
File metadata and controls
29 lines (23 loc) · 671 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 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)
std::cout<< "Division: Error - cannot divide by zero!\n";
else
std::cout<< "Division: "<< first<< "/"<< second<< "=" << (first/second)<<std::endl;
// new change
return 0;
}