内容发布更新时间 : 2024/11/5 16:31:38星期一 下面是文章的全部内容请认真阅读。
#include
sin.str(gets()); sin.clear(); sin >> birthPlace; cout << endl << setw(20) << \生日:\; sin.str(gets()); while (true){ sin.clear(); sin >> birthDay.year >> birthDay.month >> birthDay.day; if ( !sin||birthDay.year > 2014 || birthDay.month > 12 || birthDay.day > 31){ cout << \输入错误,请重新输入:\; sin.str(gets()); } else break; } cout << endl << setw(20) << \性别:\; sin.str(gets()); sin.clear(); while (sin >> sex){ if (sex == \ || sex == \ || sex == \男\ || sex == \女\) break; else{ cout << \性别必须是male、female、男或者女,请重新输入:\; sin.str(gets()); sin.clear(); } } cout << endl << setw(20) << \身高(厘米):\; sin.str(gets()); sin.clear(); while (!(sin >> height)){ cout << \输入错误,请重新输入:\; sin.str(gets()); sin.clear(); } cout << endl << setw(20) << \年龄:\; sin.str(gets()); sin.clear(); while (!(sin >> age) || age > 300){ cout << \输入错误,请重新输入:\ << endl; sin.str(gets()); sin.clear(); } cout << endl << setw(20) << \学历:\;
sin.str(gets()); sin.clear(); sin >> education; cout << endl << setw(20) << \工作:\; sin.str(gets()); sin.clear(); sin >> job; cout << endl << setw(20) << \父亲:\; sin.str(gets()); sin.clear(); sin >> father; } catch (int ex){ throw ex; } return; }