2022年车友信息管理系统程序设计 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年车友信息管理系统程序设计 .pdf》由会员分享,可在线阅读,更多相关《2022年车友信息管理系统程序设计 .pdf(28页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、5、#include #include #includefile.h #includestring.h #includectype.h #includewindows.h #includeconio.h #includemalloc.h void menu() /一级菜单函数 printf(*1. 显示车友信息*n); printf(*2. 车友信息管理*n); printf(*3. 车友人数统计*n); printf(*4. 根据条件查询*n); printf(*0. 退出*n); printf(n); void menuBase() /车友信息管理的二级菜单 printf(*1. 增加车友
2、信息*n); printf(*2. 删除车友信息*n); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 28 页 - - - - - - - - - printf(*3. 修改车友信息*n); printf(*0. 返回上级菜单*n); printf(n); void menuCount() /车友人数统计的二级菜单 printf(*1. 车友总人数*n); printf(*2. 车辆品牌的车友人数*n); printf(*0. 返回上级菜单*n); printf(n)
3、; void menuSearch() /根据条件查询的二级菜单 printf(*1. 根据车款查询车友信息*n); printf(*2. 根据性别查询车友信息*n); printf(*0. 返回上级菜单*n); printf(n); struct node * baseManage(struct node *head) /车友信息管理模块的实现 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 28 页 - - - - - - - - - int choice; Type
4、 data; long s1; char s220; do /用 dowhile 语句可以多次选择二级菜单 menuBase(); /调用二级菜单显示函数printf(choice one operation you want to do:n); scanf(%d,&choice); /输入选择项switch(choice) case 1: readNode(&data); /首先读入待插入的车友信息,再插入head=InsertOrder(head,data,1); break; case 2: printf(Input the VIP number deletedn);/读入会员名, 根据
5、会员名进行删除(会员名就是一个号,相当于学号)scanf(%d,&data.VIPnum); head=Delete(head,data); break; case 3: printf(P;ease input thr VIP number and his name to be xiugai.n); printf(VIPnum: ); scanf(%ld,&s1); printf(name: ); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 28 页 - - - -
6、- - - - - scanf(%s,&s2); Revise(head,s2,s1); break; case 0: break; while(choice); /还是回到二级菜单允许再次选择二级功能return head; int Count(struct node *head) /求总人数 struct node *p; int count=0; /count 统计总人数for(p=head;p;p=p-next) count+; return count; int brandCount(struct node *head,char *s) 名师资料总结 - - -精品资料欢迎下载 -
7、- - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 28 页 - - - - - - - - - int count=0; struct node *p; for(p=head;p;p=p-next) if(strcmp(p-data.brand,s)=0) count+; return count; struct node *countManage(struct node *head) /车友人数统计模块的实现 int choice,all,brandcount; char s20; do menuCount(); p
8、rintf(choice one operation you want to do:n); scanf(%d,&choice); switch(choice) case 1: printf(the number of the people is:n); all=Count(head); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 28 页 - - - - - - - - - printf(all=%d,all); printf(n); break; case 2: p
9、rintf(Please input the brand will be searched:n); scanf(%s,s); brandcount=brandCount(head,s); printf(brandcount=%d,brandcount); printf(n); printf(n); break; case 0: saveFile(head); break; while(choice); return head; struct node *searchManage(struct node *head) /根据条件查询模块的实现 int choice; Type data; do
10、/用 dowhile 语句可以多次选择二级菜单名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 28 页 - - - - - - - - - menuSearch(); printf(choice one operation you want to do:n); scanf(%d,&choice); /输入选择项switch(choice) case 1: printf(Input a VIPs cars brand will be searched:n); scanf(%
11、s,&data.brand); /输入车款,将根据车款查询SearchNode(head,data,choice); printf(n); break; case 2: printf(Input a VIPs sex will be searched:n); scanf(%s,&data.sex); /输入性别,将根据性别查询SearchNode(head,data,choice); printf(n); break; case 0:break; while(choice); /返回二级菜单允许再次选择二级功能return head; /返回头指针 名师资料总结 - - -精品资料欢迎下载 -
12、 - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 28 页 - - - - - - - - - struct node* runMain(struct node *head,int choice) /该函数受 main 调用,根据选择项分别调用 / 函数实现各模块的功能switch(choice) case 1: printHead(); /选择 1.先输出表头head=printList(head); /调用函数完成显示车友信息的功能break; case 2: head=baseManage(head); /选择
13、 2.调用函数完成车友信息管理功能break; case 3: head=countManage(head); /选择 3,调用函数完成车友人数统计的功能break; case 4: head=searchManage(head); /选择 4,调用函数完成根据条件查询的功能break; case 0: break; return head; /返回头指针 int main() char d6; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 28 页 - - - - -
14、 - - - - char m6; m0=8,m1=8,m2=0,m3=5,m4=0,m5=5; /数组比较printf( 请输入六位数密码:); /输入密码for (int n=0;) for(int i=0;i=0|di=a|di=A|di3) printf(errorn); exit (0); n+; struct node *head=NULL; int choice; head=readFile(head); if(!head) createFile(); head=readFile(head); do menu(); printf(Please input your choice:
15、); scanf(%d,&choice); if(choice=0&choice=4) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 28 页 - - - - - - - - - head=runMain(head,choice); else printf(erroe input,please input your choice again!n); while(choice); saveFile(head); return 0; 4、file,h #include #
16、include #includelist.h void createFile() /建立初始的数据文件 Type data; int n,i; FILE *fp; 文件 .txt,w)=NULL) /指定好文件名,以写入方式打开 printf(can not open file cashbox.txt!n); /若打开失败,输出提示信息,退出exit(0); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 28 页 - - - - - - - - - printf(ho
17、w many records do you want to add?n); scanf(%d,&n); printf(input Carfriends informationn); for(i=1;inext,sizeCfr,1,fp); /则将 p 所指的结点数据值写入文件中p=p-next; /p 指针后移,准备处理下一个结点 fclose(fp); /关闭文件 3、list.h #includeprepare.h /文件包含,本文件是对结点数据域为Type 类型的单链表进行的处理struct node *CreateBackward(); /后插法新建链表struct node *Cre
18、ateForward(); /前插法新建链表struct node *CreateInsert(); /按序插入法新建链表struct node *printList(struct node *head); /链表的遍历struct node *SearchNode(struct node *head,Type data,int condition); /单链表的查找struct node *InsertAfter(struct node *head,Type data); /尾部插入struct node *InsertOrder(struct node *head,Type data,in
19、t condition); /有序插入struct node *Delete(struct node *head,Type data); /删除结点struct node *Recerse(struct node *head); /单链表的逆置struct node *printList(struct node *head) /链表的遍历名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 14 页,共 28 页 - - - - - - - - - struct node *p; if(h
20、ead=NULL) /如果链表原来为空 printf(nNo Recordsn); /输出提示信息,然后返回return NULL; for(p=head;p;p=p-next) /p 从头指针开始,每循环一次向后移1 结点位置 printNode(p-data); /p 非空时执行循环体,调用 printNode 函数输出结点的元素值printf(n); printf(n); /然后换行return head; /返回头指针 struct node *CreateBackward() /后插法新建链表 struct node *head,*p,*tail; /tail 用来定位于当前链表中最
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年车友信息管理系统程序设计 2022 年车友 信息管理 系统 程序设计
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内