C++ class program (function with return value)
#include<iostream.h>
#include<conio.h>
class student // student is a class
{
public :
int add(int a,int b)
{
int c;
c=a+b;
return c;
}
};
main()
{
clrscr();
student s1;
int a,b;
cout <<"enter any number";
cin >> a;
cout <<"enter any number";
cin >> b;
int c=s1.add(a,b); // calling of a function
cout << c <<endl;
getch();
}
Mar 20, 2007
C++ class program (function with return value)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment