-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalculater.cpp
50 lines (50 loc) · 1.45 KB
/
calculater.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
#include <iostream>
using namespace std;
int main(){
float value_first = 0;
float value_second = 0;
float value = 0;
cout << "Pick one number please"<<endl;
cout << " 1 for addition " <<endl;
cout << " 2 for subtraction "<<endl;
cout << " 3 for multiplication "<<endl;
cout << " 4 for division "<<endl;
cout << " enter = ";
cin >> value;
if(value == 1){
cout << "enter the first number for addition = ";
cin >> value_first;
cout << "enter the secound number = ";
cin >> value_second;
float ans = value_first + value_second;
cout << "ans is = " << ans;
}
else if(value == 2){
cout << "enter the first number for subtraction = ";
cin >> value_first;
cout << "enter the secound number = ";
cin >> value_second;
float ans = value_first - value_second;
cout << "ans is = " << ans;
}
else if(value == 3){
cout << "enter the first number for multiplication = ";
cin >> value_first;
cout << "enter the secound number = ";
cin >> value_second;
float ans = value_first * value_second;
cout << "ans is = " << ans;
}
else if(value == 4){
cout << "enter the first number for division = ";
cin >> value_first;
cout << "enter the secound number = ";
cin >> value_second;
float ans = value_first / value_second;
cout << "ans is = " << ans;
}
else {
cout << "you are so wrong bro";
}
return 0;
}