-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.cpp
More file actions
46 lines (39 loc) 路 926 Bytes
/
Copy pathCalculator.cpp
File metadata and controls
46 lines (39 loc) 路 926 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
auto& out = std::cout;
auto& in = std::cin;
int main(){
char op;
double num1;
double num2;
double result;
out << "***************** CALCULATOR *****************"<<'\n';
out << "ENter the operator ( + - / *) : ";
in>> op;
out << "Enter the first Number : ";
in >> num1;
out << "Enter the second Number : ";
in >> num2;
switch(op){
case '+':
result = num1 + num2;
out << "Result : " << result << '\n';
break;
case '-':
result = num1 - num2;
out << "Result : " << result << '\n';
break;
case '*':
result = num1 * num2;
out << "Result : " << result << '\n';
break;
case '/':
result = double(num1) / num2;
out << "Result : " << result << '\n';
break;
default :
out << "Plz Enter the Valid Operator"<< '\n';
break;
}
out << "**********************************************";
return 0;
}