个人信息管理C课程设计.doc

上传人:本田雅阁 文档编号:2051766 上传时间:2019-02-08 格式:DOC 页数:7 大小:53.51KB
返回 下载 相关 举报
个人信息管理C课程设计.doc_第1页
第1页 / 共7页
个人信息管理C课程设计.doc_第2页
第2页 / 共7页
个人信息管理C课程设计.doc_第3页
第3页 / 共7页
亲,该文档总共7页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《个人信息管理C课程设计.doc》由会员分享,可在线阅读,更多相关《个人信息管理C课程设计.doc(7页珍藏版)》请在三一文库上搜索。

1、#include #include #include #include using namespace std; class person public:string m_id; /身份证号 string m_Name; /姓名int m_age; /年龄 string m_Sex; /性别string m_nation; /民族 person *Next; /-函数声明- person* Create( person* Head); void Release( person* Head); person* Add( person* Head);bool Search( person* Hea

2、d); person* idcard( person* Head);void Display_List( person* Head); void Display_Node( person* pNode); person* update( person* Head); person* Del( person* Head); person* Sort( person* Head);/-函数实现- person* Create( person* Head) Head=( person*)new person; if(!Head) cout分配内存失败!m_id=;Head-m_Name=; Head

3、-m_age=0; Head-m_Sex=;Head-m_nation=;Head-Next=NULL;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;coutid;coutendlname; co

4、utendlage;coutendlsex; coutendlnation; coutm_id=id;pNew-m_Name=name; pNew-m_age=age;pNew-m_Sex=sex; pNew-m_nation=nation; pNew-Next=Head-Next;Head-Next=pNew; cout数据添加成功!是否继续添加?(Y/N)ch;system(cls);while(ch=Y|ch=y);return Head; bool Search( person* Head) /查询 person* ptr; string name;ptr=Head-Next; cou

5、tendlname; coutendl*查询结果*endl; coutsetw(10)left身份证号 setw(10)left姓名 setw(10)left年龄 setw(10)left性别 setw(10)left民族endl; cout*m_Name=name)Display_Node(ptr); return true; ptr=ptr-Next; cout查无此人!endl; return false; person* idcard_Front( person* Head) /根据身份证号查询person* ptr;string id;ptr=Head;coutid;coutendl

6、* 查 询 结 果 *Next) if(ptr-Next-m_id=id) Display_Node(ptr); return ptr; ptr-Next=ptr-Next-Next; return ptr;void Display_List(person* Head)person* ptr;ptr=Head-Next;cout* 所 有 个 人 信 息 *endl; coutsetw(10)left身份证号 setw(10)left姓名 setw(10)left年龄 setw(10)left性别 setw(10)left民族endl;cout*Next; cout*endl; void Di

7、splay_Node(person* pNode) coutsetw(10)leftm_id setw(10)leftm_Name setw(10)leftm_age setw(10)leftm_Sex setw(10)leftm_nationNext) cout*请修改!*endl;coutid;coutendlname; coutendlage; coutendlsex; coutendlnation; coutNext-m_id=id; ptr-Next-m_Name=name; ptr-Next-m_age=age;ptr-Next-m_Sex=sex;ptr-Next-m_natio

8、n=nation; cout恭喜你,修改信息成功!endl; else cout没找到此个人记录,无法修改。Next; if(ptr) ptr_front-Next=ptr-Next; delete ptr; cout恭喜你,删除信息成功!。endl; return Head; int main() cout *endlendl; cout *个人信息管理系统*endlendl; coutendlendlendl; int q=110,w=110; number: int e; coute; if(q=e) number1: /语句标号 int r; coutr; if (w=r) perso

9、n* Head=0; Head=Create(Head); int menu; system(cls); while(1) cout*endl; cout| 菜单选顶 | endl; cout| | endl; cout| 1.录入个人信息 2.修改 | endl; cout| 3.删除 4.查询 | endl; cout| 5.保存 0.退出 | endl; cout*endl; coutendlmenu; switch(menu) case 0: cout *endl; cout * 成功退出系统! *endl; cout *endl; return 0; case 1: Head=Add(Head); break; case 2: Head=update(Head); break; case 3: Head=Del(Head); break; case 4: Search(Head); break; default: cout请选择正确的菜单选项!endl; Release(Head); return 0; else cout*密码错误!请重新输入 *endl; goto number1; else cout* 账号错误!请重新输入*endl; goto number;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1