#include <iostream>
#include <string>
using namespace std;
class CStudent
{
private:
string name;
int num;
char sex;
int age;
public:
void set_value();
void display();
};
void CStudent::set_value()
{
cin>>name>>num>>sex>>age;
}
void CStudent::display()
{
cout<<name<<" "<<num<<" "<<sex<<" "<<age<<endl;
}
int main()
{
CStudent stu;
stu.set_value();
stu.display();
return 0;
}
对这段程序怎么进行初始化??+这段
CStudent()
{name[20]=0;num=0;sex=0;age=0;
}算初始化吗??