#include<conio.h>
using namespace std;
int main(){
double var1,var2;
int choice;
char yn;
ss:
cout<<"1.Addition\t2. Subtraction\t3. Multiplication\t4. Division\n";
cin>>choice;
switch(choice){
case 1:
cout<<"Enter two numbers\n";
cin>>var1>>var2;
cout<<"Sum of "<<var1<<" and "<<" is "<<var1+var2<<endl;
rr:
system("pause");
cout<<"Do you want to continue (y/n) ? ";
cin>>yn;
if(yn=='y' || yn=='Y')
goto ss;
else
exit(0);
break;
case 2:
cout<<"Enter two numbers\n";
cin>>var1>>var2;
cout<<"Difference of "<<var1<<" and "<<" is "<<var1-var2<<endl;
goto rr;
break;
case 3:
cout<<"Enter two numbers\n";
cin>>var1>>var2;
cout<<"Product of "<<var1<<" and "<<" is "<<var1*var2<<endl;
goto rr;
break;
case 4:
cout<<"Enter two numbers\n";
cin>>var1>>var2;
cout<<"Division of "<<var1<<" and "<<" is "<<var1/var2<<endl;
goto rr;
break;
default:
cout<<"Invailid choice.....\nDo you want to try again (y/n) ? ";
cin>>yn;
if(yn=='y' || yn=='Y')
goto ss;
else
exit(0);
}
getch();
return 0;
}
No comments:
Post a Comment