#include<conio.h>
#include<iostream>
using namespace std;
int k;
class Calci
{
private:
int a,b,c;
public:
int n;
void mul();
void add();
void sub();
void div();
void putdata();
void getdata();
};
int main()
{
Calci e;
cout<<"\n \n Welcome....! We hope that we will save your
valuable time."<<endl;
cout<<"\n -----------------------------------------------
------------------"<<endl;
cout<<"How can we help you , please select appropriate
option"<<endl;
cout<<"Addition >> 1"<<endl;
cout<<"Subtraction >> 2"<<endl;
cout<<"Multiplication >> 3"<<endl;
cout<<"Divison >> 4"<<endl;
cin>>k;
e.putdata();
switch(k)
{
case 1:
e.add();
break;
case 2:
e.sub();
break;
case 3:
e.mul();
break;
case 4:
e.div();
default:
cout<<"You have entered wrong option";
}
if(k<=4)
{
e.getdata();
}
getch();
return 0;
}
void Calci::mul()
{
c=a*b;
}
void Calci::add()
{
c=a+b;
}
void Calci::sub()
{
c=a-b;
}
void Calci::div()
{
c=a/b;
}
void Calci::putdata()
{
cout<<"Enter two values :"<<ends;
cin>>a>>b;
}
void Calci::getdata()
{
cout<<"Result will be :"<<c;
}
Comment your doubt below.
2 Comments
Iska output result show kro shubham
ReplyDeletePlease run it
DeleteTell us your queries or more topics which you want