班级通信录程序设计课程设计文档

上传人:pu****.1 文档编号:464677586 上传时间:2023-05-16 格式:DOC 页数:11 大小:45KB
返回 下载 相关 举报
班级通信录程序设计课程设计文档_第1页
第1页 / 共11页
班级通信录程序设计课程设计文档_第2页
第2页 / 共11页
班级通信录程序设计课程设计文档_第3页
第3页 / 共11页
班级通信录程序设计课程设计文档_第4页
第4页 / 共11页
班级通信录程序设计课程设计文档_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《班级通信录程序设计课程设计文档》由会员分享,可在线阅读,更多相关《班级通信录程序设计课程设计文档(11页珍藏版)》请在金锄头文库上搜索。

1、源代码:#include#include#include#define N sizeof(struct student)struct student /结构体声明 char name5; char sex2; int age; int grade; char major10; int cla; char address30; char tel20; char qq15; char email30; struct student * next;int main() /主函数 void menu(); /函数声明局部 struct student *creat(); void printsort(

2、struct student *head); struct student * write(struct student *head); struct student * sort(struct student *head); struct student * addsort(struct student *head); struct student * findname(struct student *head); struct student * correct(struct student *head); struct student * del(struct student *head

3、); struct student *readsort(); int n; /变量声明 struct student *head; head=creat(); again:menu(); printf(请输入你的选择注意数据范围在16内:); scanf(%d,&n); switch(n) case 1: /录入数据 head=write(head); printsort(head); break; case 2: head=sort(head); break; / 按某种方式排序并存入文件 case 3: head=findname(head); head=write(head); prin

4、tsort(head);break; /按某种方式查询 case 4: head=addsort(head); /添加校友信息 head=write(head); printsort(head);break; case 5: head=correct(head); head=write(head); printsort(head);break; /修改校友信息 case 6: head=del(head); head=write(head); printsort(head);break; /删除校友信息 case 7:head= readsort(); printsort(head);brea

5、k; case 8:return 0; /退出程序 default:printf(数据错误!请重新输入16范围内数据!n); goto again; system(pause); return 0;void menu() /菜单函数 system(cls); printf(*欢迎使用校友通讯录系统!*nn); printf(请选择以下功能:n); printf(*-*n); printf(*1:录入数据; *n); printf(*2:按某种方式排序; *n); printf(*3:查询校友信息; *n); printf(*4:添加校友信息; *n); printf(*5:修改校友信息; *n

6、); printf(*6:删除校友信息; *n); printf(*7:从文件中读取数据; *n); printf(*8:退出程序; *n); printf(*-*n); void printsort(struct student *head) /打印原始校友信息 struct student *p; printf(目前已有的校友信息如下:n); printf(*校友通讯录*n); printf(姓名t性别t年龄t年级t专业t班级t地址t tQQt邮箱n); p=head; if(head!=NULL) do printf(%st%st%dt%dt%st%dt%st%st%st%sn,p-na

7、me,p-sex,p-age,p-grade,p-major,p-cla,p-address,p-tel,p-qq,p-email); p=p-next; while(p!=NULL); getchar(); /接受回车键 getchar(); /使程序暂停 struct student *creat() /创立链表函数 struct student *head,*p1,*p2; int n=0; p1=p2=(struct student *)malloc(N); /第一个结点 head=NULL; while(1) n+=1; if(n=1) printf(请输入校友的姓名当输入数据为nu

8、ll时结束添加操作:); scanf(%s,p1-name); if(strcmp(p1-name,null)=0) break; printf(请输入通讯录信息每输入一项信息敲空格一次:性别 年龄 年级 专业 班级 通讯地址 qq emailn 请输入:);/输入信息 scanf(%s%d%d%s%d%s%s%s%s,p1-sex,&p1-age,&p1-grade,p1-major,&p1-cla,p1-address,p1-tel,p1-qq,p1-email); head=p1; /定位头结点 else p2-next=p1; p2=p1; p1=(struct student *)malloc(N); /开辟新结点,输入其他成员信息 printf(请输入所添加校友的姓名当输入数据为null时结束添加操作:); scanf(%s,p1-name); if(strcmp(p1-name,null)=0) break; printf(请输入通讯录信息每输入一项信息敲空格一次:性别 年龄 年级 专业

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

最新文档


当前位置:首页 > 商业/管理/HR > 商业计划书

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