You are on page 1of 6

#include<iostream.

h>
02.
#include<process.h>
03.
void main()
04.
{
05.
int num1,num2,res;
06.
char ch,choice,count;
07.
count=0;
08.
z:
09.
cout<<"*********************************************************************
**********"<<endl;
10.
cout<<"Press * for multiplication, + for addition, - subtraction, /
division"<<endl;
11.
cout<<"*********************************************************************
**********"<<endl;
12.
cin>>ch; count++;
13.

switch(ch)
14.
{
15.
case '+':
16.
cout<<"/////////////////////////"<<endl;
17.
cout<<"Enter two numbers"<<endl;
18.
cout<<"/////////////////////////"<<endl;
19.
cin>>num1>>num2;
20.
res=num1+num2;
21.
cout<<"Your query returned"<<" "<<res<<endl;
22.
break;
23.

24.
case '-':
25.
cout<<"/////////////////////////"<<endl;
26.

cout<<"Enter two numbers"<<endl;


27.
cout<<"/////////////////////////"<<endl;
28.
cin>>num1>>num2;
29.
res=num1-num2;
30.
cout<<"Your query returned"<<" "<<res<<endl;
31.
break;
32.

33.
case '*':
34.
cout<<"/////////////////////////"<<endl;
35.
cout<<"Enter two numbers"<<endl;
36.
cout<<"/////////////////////////"<<endl;
37.
cin>>num1>>num2;
38.
res=num1*num2;
39.

cout<<"Your query returned"<<" "<<res<<endl;


40.
break;
41.

42.
case '/':
43.
m:
44.
cout<<"/////////////////////////"<<endl;
45.
cout<<"Enter two numbers"<<endl;
46.
cout<<"/////////////////////////"<<endl;
47.
cin>>num1>>num2;
48.
if(num2==0)
49.
{
50.
cout<<"Sorry, please enter a value which is not zero"<<endl;
51.
goto m;
52.

}
53.
res=num1/num2;
54.
cout<<"Your query returned"<<" "<<res<<endl;
55.
break;
56.
default:
57.
cout<<"Please select anyone option"<<endl;
58.

59.
};
60.
if(count==3)
61.
{cout<<"You already used the program thrice...";
62.
exit(0);}
63.
cout<<"::::::::::::::::::::::::::::::::::::::::"<<endl;
64.
cout<<"Do you want to continue? (Press Y/N)"<<endl;
65.

cout<<"::::::::::::::::::::::::::::::::::::::::"<<endl;
66.
cin>>choice;
67.
if((choice=='Y')||(choice=='y'))
68.
{goto z;}
69.
}

You might also like