WAP To Create A Calculator.
#include<iostream.h>
#include<conio.h>
Void main()
{ clrscr();
char ch();
float a,b,result;
cout<<”Enter two no.:”;
cin>>a>>b;
cout<<”\n”<<”Enter the
operator(+,-,*,/):”;
cin>>ch;
cout<<”\n”;
If(ch==’+’)
result=a+b;
If(ch==’-’)
result=a-b;
If(ch==’*’)
result=a*b;
If(ch==’/’)
result=a/b ;
cout<<”Wrong operator\n”;
cout<<”\n”<<”The calculated
result is:”<<result<<”\n”;
getch();
}
Comments
Post a Comment