#include<iostream.h>
//using namespace std;
class Person
{
char name[30];
int age;
public:
void get_data(void);
void display();
};
void Person::get_data(void)
{
cout<<"Enter the name : ";
cin>>name;
cout<<"\nEnter the age : ";
cin>>age;
};
void Person::display(void)
{
cout<<"\nName : "<<name;
cout<<"\nAge : "<<age;
};
void main()
{
Person p;
p.get_data();
p.display();
}
No comments:
Post a Comment