#include <iostream>
#include <string.h>
using namespace std;
class Person {
private:
char name[50];
int age;
char sex;
public:
void Register(const char n[], int num, char c);//最好带上const
void ShowMe();
};
int main() {
Person person1, person2;
char s[50];
int num;
char c;
cin >> s >> num >> c;
person1.Register(s, num, c);
person2.Register("Zhang3", 19, 'm');
person1.ShowMe();
person2.ShowMe();
return 0;
}
void Person::Register(const char n[], int num, char c) {
strcpy(name, n); //就是字符串赋值的作用
age = num;
sex = c;
}
void Person::ShowMe() {
cout << name << " ";
cout << age << " ";
cout << sex << endl;
}