#include <iostream>
using namespace std;
int main ()
{
char op;
float a, b;
cout << "Enter operator : +, -, *, /: ";
cin >> op;
cout << "Enter first number:";cin >> a;
cout << "Enter second number:";cin >>b;
switch(op) {
case '+':
cout << a << " + " << b << " = " << a + b;
break;
case '-':
cout << a << " - " << b << " = " << a - b;
break;
case '*':
cout << a << " * " << b << " = " << a * b;
break;
case '/':
cout << a << " / " << b << " = " << a / b;
break;
default:
cout << "wrong input \nOperator is not correct"; break;
}
return 0;
}
0 Comments
Post a Comment