/********************************************/
#include <iostream>
#include <conio>
class DS
{
private:
int my_array[2],i,result;
char opr;
public:
void input()
{
cout<<"Enter any two number\n";
for(i=0;i<2;i++)
cin>>my_array[i];
}
/********************/
void show()
{
while(1)
{
cout<<"\t\tchoise any operator \n\t\t+\n\t\t-\n\t\t*\n\t\t/\t\t\n\t\tfor clear screen press C\n\t\tif you want to enter number again then press A\n";
cin>>opr;
switch(opr)
{
case '+':
result=my_array[0]+my_array[1];
cout<<"Result=\t\t"<<result<<endl;
break;
case '-':
result=my_array[0]-my_array[1];
cout<<"Result=\t\t"<<result<<endl;
break;
case '*':
result=my_array[0]*my_array[1];
cout<<"Result=\t\t"<<result<<endl;
break;
case '/':
result=my_array[0]/my_array[1];
cout<<"Result=\t\t"<<result<<endl;
break;
case 'c':
case 'C':
clrscr();
break;
case 'A':
case 'a':
input();
break;
default:
cout<<"Invalid option\n\n";
break;
}
}
}
};
void main()
{
DS s;
s.input();
s.show();
getch();}
0 comments:
Post a Comment