C++ cin.getline(,)的问题

来源:百度知道 编辑:UC知道 时间:2024/06/13 22:46:59
void setfamilymember(familymember & p)
{
cout<<"Please input the name of the family member"<<endl; //输入名字
cin.getline(p.membername,40);
cout<<"Please input the homeplace of the family member"<<endl; //输入出生地
cin.getline(p.homeplace,40);
cout<<"Please input the membersex of the family member"<<endl; //输入性别
cin.getline(p.membersex,6);
cout<<"Please input the stature of the family member"<<endl; //输入身高
cin.getline(p.membersex,3);
cout<<"Please input the edudegree of the family member"<<endl; //输入教育程度
cin.getline(p.edudegree,20);
cout<<"Please input the occupation of the family member"<<endl; //输入职业
cin.getline(p.occupation,20);
cout<<"Please input the zhicheng of the family member"<<endl; //输入职称
cin.getline(p.zhicheng,20);
cout<<"Please input the b

1、将
cin.getline(p.stature,3);
修改为
cin.getline(p.stature,4);
2、将结构familymember的成员stature的维数定义大于等于4。

cout<<"Please input the membersex of the family member"<<endl; //输入性别
cin.getline(p.membersex,6);
cout<<"Please input the stature of the family member"<<endl; //输入身高
cin.getline(p.membersex,3);
两个都是sex,应该这里有问题吧!
能不能把你的familymember的定义给出来?