forked from RoSPinoT/Open_source_contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasiccalc.cpp
More file actions
49 lines (31 loc) · 742 Bytes
/
basiccalc.cpp
File metadata and controls
49 lines (31 loc) · 742 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
47
48
49
#include <iostream>
using namespace std;
int main(){
char op;
int number1,number2;
cout<<" enter the first number: "<<endl;
cin>>number1;
cout<<" enter the oprator "<<endl;
cin>>op;
cout<<" enter the second number: "<<endl;
cin>>number2;
cout<<"result: "<<endl;
switch(op)
{
case '+' :
cout<<number1+number2;
break;
case '-' :
cout<<number1-number2;
break;
case '*' :
cout<<number1*number2;
break;
case '/' :
cout<<number1/number2;
break;
default:
cout<<"select oprator form following + / - * ";
break;
}
return 0;}