已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Landh.h-#include#include#include#include landh.husing namespace std;/学生函数student:student()Name0=0; Num=0;Sex0=0; Age=0;Tele0=0; Email0=0;student:student(char name,int no,char sex,int age,char tele,char email)strcpy(Name,name); Num=num;strcpy(Sex,sex); Age=age;strcpy(Tele,tele); strcpy(Email,email);/添加函数void student:add()ofstream out(student.txt,ios_base:in|ios_base:app);out NametNotSextAgetTeletEmailendl;out.close();void student:set(char name,int no,char sex,int age,char tele,char email)strcpy(Name,name); No=no;strcpy(Sex,sex); Age=age;strcpy(Tele,tele); strcpy(Email,email);/显示函数void showall()char name20;int num;char sex2;int age;char tele20;char email30;cout姓名t编号t性别t年龄t电话 t邮箱namenosexageteleemail;if(ifile.eof()!=0) break;coutnametnotsextagetteletemailendl; ifile.close();/查询函数void found(char name,int count)int i,c=0; /c用于判断是否存在student a1000; ifstream in(student.txt);for(i=0;iai.Nameai.Noai.Sexai.Ageai.Teleai.Email; in.close();for (i=0;i=count;i+) if (strcmp(ai.Name,name)=0) cout姓名t编号t性别t年龄t电话 t邮箱endl; coutai.Nametai.Notai.Sextai.Agetai.Teletai.Emailendl; c+; if(c=0) cout查无此人endl; /删除函数void dele(int num,int count)int i,t,c=0,q; /q用于判断是否删除student a1000; ifstream in(student.txt);for(i=0;iai.Nameai.Noai.Sexai.Ageai.Teleai.Email; in.close();for (i=0;icount;i+) if (ai.Num=num)c+;coutendl;cout姓名t编号t性别t年龄t电话 t邮箱endl; coutai.Nametai.Notai.Sextai.Agetai.Teletai.Emailendl;coutq;if(q=1)ofstream out(student.txt); for(t=0;ti;t+)out at.Nametat.Notat.Sextat.Agetat.Teletat.Emailendl; for(t=i+1;tcount;t+) out at.Nametat.Notat.Sextat.Agetat.Teletat.Emailendl; out.close(); cout已删除。endl;count-; ofstream outc(count.dat,ios_base:in|ios_base:out|ios_base:trunc); outccount; outc.close(); if(c=0)cout无此人endl;/修改函数void reset(int no,int count)int i,t,c=0;student a1000;char name20;char sex20;int age;char tele20;char email30; ifstream in(student.txt);for(i=0;iai.Nameai.Noai.Sexai.Ageai.Teleai.Email; in.close();for (i=0;icount;i+)if (ai.Num=num)c=1;while(1)cout请选择修改项:1.姓名。endl; cout 2.性别。endl; cout 3.年龄。endl; cout 4.电话。endl; cout 5.邮箱。endl;cout 6.结束。t; if(t=1)cout姓名:ai.Nametname; strcpy(ai.Name,name); if(t=2) cout性别:ai.Sextsex; strcpy(ai.Sex,sex); if(t=3) cout年龄:ai.Agetage; ai.Age=age; if(t=4) cout电话:ai.Telettele; strcpy(ai.Tele,tele); if(t=5) cout邮箱:ai.Emailtemail; strcpy(ai.Email,email); if(t=6) break;cout已修改。endl;cout姓名t编号t性别t年龄t电话 t邮箱endl; coutai.Nametai.Notai.Sextai.Agetai.Teletai.Emailendl;if(c=0)cout查无此人endl;ofstream out(student.txt);for(t=0;tcount;t+)out at.Nametat.Notat.Sextat.Agetat.Teletat.Emailendl;out.close();/退出函数void exit()cout按任意键退出程序!ps;in.close();coutpw;for(int i=0;i20;i+)if(psi!=pwi)t1=0; break; if(t1=1) return 1;elsecoutpw2;for(int i=0;i20;i+)if(psi!=pw2i)t2=0;break;if(t2=1)return 1;elsereturn 0;/密码修改函数void setpass()char newps20;coutnewps;ofstream out(pass.dat,ios_base:in|ios_base:out|ios_base:trunc);out-#include#include#include#include landh.husing namespace std;void main()char name20;int num,xz,count,number;char sex2;int age;char tele20;char email30;coutendlendl;cout-endl;cout* *endl;cout XXX的同学录 endl;cout* *endl;cout-number;in.close();ifstream inc(count.dat,ios_base:in);inccount;inc.close();while(1)cout请选择操作:1.添加。endl; cout 2.修改。endl; cout 3.查找。endl; cout 4.删除。endl; cout 5.显示。endl; cout 6.修改密码。endl;cout 7.退出。endl;cout-xz;if(xz=1)student a;count+;ofstream outc(count.dat,ios_base:in|ios_base:out|ios_base:trunc);outccount;outc.close();number+;ofstream out(number.dat,ios_base:in|ios_base:out|ios_base:trunc);outnumber;out.close();cout-endl;coutendl;coutname;coutsex;coutage;couttele;coutemail;a.set (name,number,sex,age,tele,email);a.add();cout已添加。endl;cout姓名t编号t性别t年龄t电话 t邮箱endl;coutnametnumbertsextagetteletemailendl;cout-endl;coutendl;system(pause); system(cls);if(xz=2)cout-endl;coutendl;coutno;reset(no,count);cout-endl;coutendl;system(pause); system(cls);if(xz=3)cout-endl;coutendl;coutname;found(name,count);cout-endl;coutendl;system(pause); system(cls);if
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 集团公司合规体系建设方案
- CN119407475A 一种高强度三维复合土工格栅的编织方法 (肥城三合工程材料有限公司)
- 项目突发质量问题应急处置流程
- 外包服务突发违约应急处置流程
- 地下管廊运维重大事故隐患判定标准
- 生鲜果蔬零售门店设计方案
- EPC总承包项目造价管控手册
- 园区智慧安防系统建设设计
- 2026年智慧法院律师服务平台建设
- 适老化居家环境设计与改造项目可行性研究报告
- 新版部编人教版六年级上册语文全册1-8单元教材分析
- 老年人居家防跌倒安全知识课
- 2026年小学数学毕业测试试卷及答案
- 2026年山东将军开元纸业有限公司招聘(13人)笔试参考题库及答案详解
- 四川雅安市国有企业招聘笔试题库2026
- 2026年上海高考物理考试真题含答案
- 外墙内保温施工方案
- 2026年财务国企招聘笔试题库(完整版含答案解析)
- 2026广西辅警笔试真题题库(含答案解析·全区完整版)
- 文物建筑勘查设计取费标准(2020年版)
- 2023-2024学年陕西省西安市雁塔区高新逸翠园中学七年级(上)分班考数学试卷
评论
0/150
提交评论