同学录源代码

上传人:s9****2 文档编号:563182140 上传时间:2023-01-27 格式:DOC 页数:10 大小:76.50KB
返回 下载 相关 举报
同学录源代码_第1页
第1页 / 共10页
同学录源代码_第2页
第2页 / 共10页
同学录源代码_第3页
第3页 / 共10页
同学录源代码_第4页
第4页 / 共10页
同学录源代码_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《同学录源代码》由会员分享,可在线阅读,更多相关《同学录源代码(10页珍藏版)》请在金锄头文库上搜索。

1、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);/

2、添加函数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()

3、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.No

4、ai.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

5、=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+

6、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

7、;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) c

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号