#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
using namespace std;
int main()
{
float x,y;
char ch;
cout<<"Enter any two number (x,y) : ";
cin>>x>>y;
system("cls");
do{
cout<<"\n==========================================\n";
cout<<"+ for addition\n";
cout<<"- for subtraction\n";
cout<<"* for multiplication\n";
cout<<"/ for divisoion\n";
cout<<"Press enter to exit\n";
cout<<"==========================================\n";
cout<<"Enter your choice : \n";
ch=getch();
switch(ch)
{
case'+':
cout<<x<<" + "<<y<<" = "<<x+y;
break;
case'-':
cout<<x<<" - "<<y<<" = "<<x-y;
break;
case'*':
cout<<x<<" * "<<y<<" = "<<x*y;
break;
case'/':
cout<<x<<" / "<<y<<" = "<<x/y;
break;
}
}while(ch!='\r');
getch();
return(0);
}
No comments:
Post a Comment