Q1. WAP to find sum of 2 number with the help of 'this' pointer.

#include <iostream>

using namespace std;

class A
{
    int a,b,c;
public :
    void input(int a, int b )
    {
        this->a= a;
        this->b= b;
    }
    void output()
    {
        c=a+b;
        cout<<"Sum = "<<c;
    }
};
int  main()
{
    int a, b;
    cout<<"Enter 2 numbers: ";
    cin>>a>>b;
    A obj;
    obj.input(a,b);
    obj.output();
}
Enter 2 numbers: 10
20
Sum = 30