//Ex6_1.cpp
#include "iostream" 
#include "cstring" 
using namespace std;
class Person
{private:
   char name[20];
   char sex;
   int age; 
 public:
   void display()
   {cout<<name<<":"<<sex<<","<<age<<endl;}
	void set(char *n,char s,int a)
	{strcpy(name,n);
     sex=s;
     age=a;}
};
void main()
{char n[20],s;
 int a;
 Person p,*p1;
 p.set("WangHong",'m',20);   //调用类的成员函数
 p.display();
 cout<<"Enter a Person's name,age and sex:";
 cin>>n>>s>>a;
 p.set(n,s,a);
 p.display();
 p1=&p;      //p1为指向对象p的指针
 p1->set("LiQi",'w',19);
 p1->display();
}
