Return to Snippet

Revision: 38459
at January 3, 2011 17:24 by vamsi


Initial Code
#include <iostream> 
// Basic program to show the usage of class and objects
// Vamsi
using namespace std;
class person {
char name[30];
int age;
public :
void getdata(void);
void putdata(void);
};
void person :: getdata(void){
cout << "Please Enter The Name \n";
cin >> name;
cout << "Please Enter The Age \n";
cin >> age;
}
void person :: putdata(void){
cout << "Name Is :" << name << "\n";
cout << name << "'s Age Is " << age << "\n";
}
int main ()
{
person a;
a.getdata();
a.putdata();
person b;
b.getdata();
b.putdata();
return 0;
}

Initial URL

                                

Initial Description
Basic usage of class and objects

Initial Title
C++ Basic usage of class and objects

Initial Tags
class

Initial Language
C++