#include<iostream.h>
int main()
{
char ch;
float a,b,result;
cout<<"\n\t Enter two numbers:";
cin>>a>>b;
cout<<"\n\t"<<"Enter the Operator(+,-,*,/):";
cin>>ch;
cout<<"\n\t";
if(ch=='+')
result=a+b;
else if(ch=='-')
result=a-b;
else if(ch=='*')
result=a*b;
else if(ch=='/')
result=a/b; // b must not be zero
else
cout<<"Wrong Operator!!\n";
cout<<"\n"<<"The Calculated Result is:"<<result<<"\n";
return 0;
}
Labels: c language, c plus plus, C programming, C++, C++ Programming, source code