Created
April 23, 2017 15:09
-
-
Save patelmilanun/53c361c926141736f07bca4c593b782f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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