Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class ADD
- {
- public:
- ADD(int i = 0)
- {
- total = i;
- }
- void Addnumber(int num)
- {
- total = total + num;
- }
- int Gettotal()
- {
- return total;
- }
- private:
- int total;
- };
- int main()
- {
- ADD add_number;
- int a, b, c;
- cout<<"Enter three numbers: ";
- cin>>a>>b>>c;
- add_number.Addnumber(a);
- add_number.Addnumber(b);
- add_number.Addnumber(c);
- cout<<"\nTotal = "<<add_number.Gettotal();
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement