/*CACULATOR*/
#include <iostream.h>
#include <conio.h>
void main()
{cout<<" CALCULATOR "<<endl;
float x,y;
char z;
float result;
while(cin>>x>>z>>y)
{
switch(z)
{
case '+':
result=x+y;
break;
case '-':
result=x-y;
break;
case '*':
result=x*y;
break;
case '/':
result=x/y;
break;
default:
cout<<"invalid entry"<<endl;
continue;/*start next loop iteration.*/
}
cout<<result<<endl<<endl;}
getch();
}
0 comments:
Post a Comment