Print Friendly and PDF
# include <iostream> 
# include <conio.h> 
using namespace std; 
int main() 
{ 
float a,b,c; 
char op; 
cout << "enter value"<<endl; 
cin >> a; 
cin >> b; 
cout << "enter operation+,-,*,/"<<endl; 
cin >> op; 
switch (op) 
{ 
case 1: 
{ 
c =a+b; 
cout <<c<<endl; 
} 
break; 
case 2: 
{ 
c = a-b; 
cout << c << endl; 
} 
break; 
case 3: 
{ 
c = a * b; 
cout << c; 
} 
break; 
case 4: 
{ 
if (b == 0) 
cout << "error"; 
else 
c = a / b; 
cout << c; 
} 
break; 
default: 
cout << "enter correct operand"<<endl; 
} 
getche(); 
}
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: