个人信息管理C课程设计_第1页
个人信息管理C课程设计_第2页
个人信息管理C课程设计_第3页
个人信息管理C课程设计_第4页
个人信息管理C课程设计_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Good is good, but better carries it.精益求精,善益求善。个人信息管理C课程设计个人信息管理C课程设计#include <string>#include <iostream>#include <fstream>#include <iomanip>using namespace std; class person public:string m_id; /身份证号 string m_Name; /姓名int m_age; /年龄 string m_Sex; /性别string m_nation; /民族 perso

2、n *Next; /-函数声明- person* Create( person* Head); void Release( person* Head); person* Add( person* Head);bool Search( person* Head); person* idcard( person* Head);void Display_List( person* Head); void Display_Node( person* pNode); person* update( person* Head); person* Del( person* Head); person* So

3、rt( person* Head);/-函数实现- person* Create( person* Head) Head=( person*)new person; if(!Head) cout<<"分配内存失败!"<<endl; return NULL; Head->m_id=""Head->m_Name="" Head->m_age=0; Head->m_Sex=""Head->m_nation=""Head->Next=NULL;

4、return Head; void Release( person* Head) person* ptr;while(Head!=NULL) ptr=Head;Head=Head->Next; delete ptr; person* Add( person* Head) /添加 person* pNew;char ch;string id,name,sex,nation; int age; do pNew=( person*)new person;cout<<"请输入身份证号:" cin>>id;cout<<endl<<

5、"请输入姓名:"cin>>name; cout<<endl<<"请输入年龄:"cin>>age;cout<<endl<<"请输入性别:" cin>>sex; cout<<endl<<"请输入民族:" cin>>nation; cout<<endl;pNew->m_id=id;pNew->m_Name=name; pNew->m_age=age;pNew->m_S

6、ex=sex; pNew->m_nation=nation; pNew->Next=Head->Next;Head->Next=pNew; cout<<"数据添加成功!是否继续添加?(Y/N)"<<endl; cin>>ch;system("cls");while(ch='Y'|ch='y');return Head; bool Search( person* Head) /查询 person* ptr; string name;ptr=Head->Next

7、; cout<<endl<<"请输入姓名:" cin>>name; cout<<endl<<"*查询结果*"<<endl; cout<<setw(10)<<left<<"身份证号" << setw(10)<<left<<"姓名" << setw(10)<<left<<"年龄" << setw(10)<

8、<left<<"性别" << setw(10)<<left<<"民族"<<endl; cout<<"*"<<endl; while(ptr) if(ptr->m_Name=name)Display_Node(ptr); return true; ptr=ptr->Next; cout<<"查无此人!"<<endl; return false; person* idcard_Front( pe

9、rson* Head) /根据身份证号查询person* ptr;string id;ptr=Head;cout<<"请输入要查询的身份证号:" cin>>id;cout<<endl<<"* 查 询 结 果 *"<<endl; while(ptr->Next) if(ptr->Next->m_id=id) Display_Node(ptr); return ptr; ptr->Next=ptr->Next->Next; return ptr;void Disp

10、lay_List(person* Head)person* ptr;ptr=Head->Next;cout<<"* 所 有 个 人 信 息 *"<<endl; cout<<setw(10)<<left<<"身份证号" <<setw(10)<<left<<"姓名" <<setw(10)<<left<<"年龄" <<setw(10)<<left<<

11、"性别" <<setw(10)<<left<<"民族"<<endl;cout<<"*"<<endl; while(ptr) Display_Node(ptr);ptr=ptr->Next; cout<<"*"<<endl; void Display_Node(person* pNode) cout<<setw(10)<<left<<pNode->m_id <<s

12、etw(10)<<left<<pNode->m_Name <<setw(10)<<left<<pNode->m_age <<setw(10)<<left<<pNode->m_Sex <<setw(10)<<left<<pNode->m_nation<<endl; person* update(person* Head) /修改person* ptr;ptr=idcard_Front(Head); string id,name,s

13、ex,nation; unsigned short int age; if(ptr->Next) cout<<"*请修改!*"<<endl;cout<<"请输入个人身份证号:"cin>>id;cout<<endl<<"请输入姓名:" cin>>name; cout<<endl<<"请输入年龄:" cin>>age; cout<<endl<<"请输入性别:&q

14、uot;cin>>sex; cout<<endl<<"请输入民族:" cin>>nation; cout<<endl;ptr->Next->m_id=id; ptr->Next->m_Name=name; ptr->Next->m_age=age;ptr->Next->m_Sex=sex;ptr->Next->m_nation=nation; cout<<"恭喜你,修改信息成功!"<<endl; else cou

15、t<<"没找到此个人记录,无法修改。"<<endl; return Head; person* Del(person* Head) /删除 person* ptr; person* ptr_front; ptr_front=idcard_Front(Head); ptr=ptr_front->Next; if(ptr) ptr_front->Next=ptr->Next; delete ptr; cout<<"恭喜你,删除信息成功!。"<<endl; return Head; int ma

16、in() cout<<" *"<<endl<<endl; cout<<" *个人信息管理系统*"<<endl<<endl; cout<<endl<<endl<<endl; int q=110,w=110; number: int e; cout<<"请输入账号:" cin>>e; if(q=e) number1: /语句标号 int r; cout<<"请输入密码:" ci

17、n>>r; if (w=r) person* Head=0; Head=Create(Head); int menu; system("cls"); while(1) cout<<"*"<<endl; cout<<"| 菜单选顶 | "<<endl; cout<<"| | "<<endl; cout<<"| 1.录入个人信息 2.修改 | "<<endl; cout<<&quo

18、t;| 3.删除 4.查询 | "<<endl; cout<<"| 5.保存 0.退出 | "<<endl; cout<<"*"<<endl; cout<<endl<<" 请选择相应操作菜单选项:" cin>>menu; switch(menu) case 0: cout<<" *"<<endl; cout<<" * 成功退出系统! *"<<endl; cout<<" *"<<endl; return 0; case 1: Head=Add(Head); break; case 2: Head=update(Head);

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论