Write a program to make the class using two numbers and use constructor in class and use avg function to take the average of numbers.


using namespace std;

class number


int X,y;


number()    /* constructor , we will not call to constructor

it will call automaticaly*/




int avg()


cout<<“x= “<<X<<endl;

cout<<“y= “<<y<<endl;

cout<<“Average= “<<(X+y)/2<<endl;



int main()


number n;

n.avg();  /*here we are calling to member function

(average) we have no need to call constructor */