Skip to content

Instantly share code, notes, and snippets.

@patelmilanun
Created April 23, 2017 15:09
Show Gist options
  • Save patelmilanun/53c361c926141736f07bca4c593b782f to your computer and use it in GitHub Desktop.
Save patelmilanun/53c361c926141736f07bca4c593b782f to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class calc
{
int a,b;
public:
void getdata()
{
cout<<"Enter a:"<<endl;
cin>>a;
cout<<"Enter b:";
cin>>b;
}
int add()
{
return a+b;
}
int sub()
{
return a-b;
}
};
int main() {
// your code goes here
calc c;
int sum,substract;
c.getdata();
sum=c.add();
substract=c.sub();
cout<<endl<<"Addition:"<<sum<<" and Substraction:"<<substract;
return 0;
}
=============================output======================================
Enter a:2
Enter b:1
Addition:3 and Substraction:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment