commit 8b69d12539dd8c1fdfd18c1dd223037f47187b79 Author: 1052720016@qq.com <1052720016@qq.com> Date: Tue Jan 8 15:46:16 2019 +0800 first commit diff --git a/1(1)(1).c b/1(1)(1).c new file mode 100644 index 0000000..bab7fd8 --- /dev/null +++ b/1(1)(1).c @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +struct birth +{ + int year,month,day; +}; +struct student +{ + int number,age,tel[20]; + char name[10],sex,address[20]; + char E_mail[20]; + struct birth birthday; + struct student *link; +}; +void show() +{ + printf("请输入数字加回车键进行选择:\n"); + printf("1.学生信息录入功能(学生信息用文件保存)-输入\n"); + printf("2.学生信息浏览功能-输出\n"); + printf("3.学生信息查询功能-按学号查询,按姓名查询\n"); + printf("4.学生信息的删除与修改\n"); + printf("按其他任意键加回车退出程序\n"); +} +void credit(int n) +{ + FILE *fp; + char fpname[20]; + struct student *head,*next,*end; + int i; + printf("请输入用于存放文件的路径及路径名:"); + scanf("%s",fpname); + getchar(); + fp=fopen(fpname,"w+"); + head=(struct student *)malloc(sizeof(struct student)); + printf("请输入学生学号 姓名 性别 出生年 月 日 地址 电话 e_mail:"); + scanf("%d %s %c %d %d %d %s %s %s",&head->number,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + getchar(); + fprintf(fp,"%d %s %c %d %d %d %s %s %s",&head->number,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + end=head; + for(i=0;inumber,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + getchar(); + fprintf(fp,"%d %s %c %d %d %d %s %s %s",&head->number,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + end->link=next; + end=next; + end->link=NULL; + } + fclose(fp); +} +void main () +{ + char get,get2; + int n; + while(1) + { + show(); + get=getchar(); + getchar(); + switch(get) + { + case '1': + printf("请输入学生人数:"); + scanf("%d",&n); + getchar(); + credit(n); + break; + } + } +} diff --git a/1(1)(1).exe b/1(1)(1).exe new file mode 100644 index 0000000..0f70fe7 Binary files /dev/null and b/1(1)(1).exe differ