Monday, 8 October 2012

CLASSES 1ST PROGRAM


#include<iostream.h>

class student{
int a,b;
int sum;
public:
void getfun(){
cout<<"Enter any two numbers: "<<endl;
cin>>a;
cin>>b;
}
void printfun(){
sum = a + b;
cout<<"the sum of those two numbers is "<<sum<<endl;

}
};

void main()
{
student obj1;
obj1.getfun();
obj1.printfun();

}



No comments:

Post a Comment