#include
class gobi
{
public:
int a,b,c;
void add();
void display();
};
int main()
{
gobi g;
g.add();
g.display();
getch();
return 0;
}
void gobi::add()
{
clrscr();
cout<<"enter the value of a\n";
cin>>a;
cout<<"enter the value of b\n";
cin>>b;
c=a+b;
}
void gobi::display()
{
cout<<"the value of c"<< c;
}
output:
enter the value of a
2
enter the value of b
4
the value of c 6
No comments:
Post a Comment