#include "" #include "" #include "" typedef struct list *LINK; LINK head;/* 头指针, 链表定位*/ struct list { int data; char name[8]; char tel[12]; int age; int scoure; struct list *front,*next; }; FILE *fp; main() { char search(LINK p,char n);/* 查询*/ LINK in_put(LINK p);/* 输入函数*/ void output(LINK sp);/* 输出*/ int insert(LINK p2);/* 插入*/ int del(LINK p2,int m);/* 删除*/ void creat();/* 输入并创建链表*/ void read();/* 读取文件内容*/ void write_fp();/* 写入文件*/ /******************************************************* ***************/ void exchange(LINK p1,LINK p2);/* 数据交换*/ pare(LINK sp,char dn,char dm);/* 比较*/ LINK bts(LINK sp,LINK p1,LINK p2,char dm);/* 从大到小排列*/ LINK stb(LINK sp,LINK p1,LINK p2,char dm);/* 从小到大排列*/ /******************************************************* ***************/ char a; FILE *fp; LINK out_fp; int d,num,menu;/*menu 菜单控制变量*/ if((fp=fopen("C:\\","r"))==NULL)/* 打开或建立文件*/{ printf("Can not open the file!\nNow the program will build a new file!\n"); fp=fopen("C:\\","wt+");/* 打开文件*/ creat();/* 创建内容*/ out_fp=head; do { fprintf(fp,"%d %s %s %d %d\n",out_fp->data,out_fp->name,\ out_fp->tel,out_fp->age,out_fp->scoure); out_fp=out_fp->next; }while(out_fp!=head); fclose(fp);/* 关闭文件*/ } else { read();/* 读取文件*/ } output(head);/* 输出链表内容*/ /********************************************************** ***************************/ do { printf("/*****Command menu list*****/\\\\\n\ \n");/* 主菜单选项,查找,插入,删除,排列,退出*/ do { printf("Please select an option:"); a=getch(); printf("%c\n",a); if(a=='1') break; else if(a=='2') break; else if(a=='3') break; else if(a=='4') break; else if(a=='0') exit(1); else menu=1; }while(menu); /*********************************************/ if(a=='4') { do { char dm,dn; printf("Order of ( )?:"); dm=getch(); printf("%c\n",dm); if((dm=='1')||(dm=='2')) { printf("Order from ( to small to big)?:"); dn=getch(); printf("%c\n",dn); if((dn=='1')||(dn
学生信息管理系统.c 来自淘豆网www.taodocs.com转载请标明出处.