第一范文网 - 专业文章范例文档资料分享平台

数据结构大作业之家谱管理系统

来源:用户分享 时间:2025/7/20 11:21:29 本文由闁芥牕瀚畵搴☆潖閿燂拷 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

#include #include #include #include #include #include\ using std::cin; using std::cout; using std::endl; using std::setw; using std::vector; using std::ios; using std::ifstream; using std::ofstream; using std::istringstream; string gets(){//从控制台获取字符等信息 string s; while (int n = _getch()){ if (n == 27){ throw 27; break; } else if (n == 13){ cout << endl; break; } else if (n == 8){ s.pop_back(); cout << \; } else{ cout << char(n); s.push_back(char(n)); } } return s; } //与BirthDay相关的函数 istream &operator>>(istream &in, BirthDay &b){//从文件中读取生日的信息 in >> b.year >> b.month >> b.day; return in; } ostream &operator<<(ostream &out, BirthDay &b){ out << b.year << \ << b.month << \ << b.day; return out; } //与Member相关的函数 void Member::setE(){ try{ istringstream sin; cout << setw(20) << \请输入成员信息:\\n\ << endl << setw(20) << \姓名:\; sin.str(gets()); sin >> name; cout << endl << setw(20) << \出生地:\;

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; }

搜索更多关于: 数据结构大作业之家谱管理系统 的文档
数据结构大作业之家谱管理系统.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c2tkvx2c7s51jxut0i32m_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top