三九宝宝网宝宝教育写作范文

C语言学生信息管理系统

01月06日 编辑 39baobao.com

#include #define LEN sizeof(struct student) #define n 10 struct student *p[n+1]; struct student { char num[30]; char name[20]; char sex[10]; int age; char native[20]; char tele[30]; char email[30]; struct student*next; }; void main() { void chose(int a); int b; printf("\n" ); printf("No:20090504121 Name:mamin Class:09wangluo(1)\n\n"); printf("Please select function Number: \n\n") ; printf("1. Create a student information table\n\n"); printf("2. Display the Student Information\n\n") ; printf("3. Exit\n\n") ; chose(b); getch(); } void chose(int a) { printf("\nchose: ") ; scanf("%d",&a); if(a==1){void input();printf("\nprint student information:\n");input();printf("\n\ninput has finished.\n");chose(a);} if(a==2){void output();output();chose(a);} if(a==3){void exit();exit();} } void input() { int i; p[0]=(struct student*)malloc(LEN); for(i=0;inum) ; printf("\nname:");scanf("%s",p[i]->name) ; printf("\nsex:");scanf("%s",p[i]->sex) ; printf("\nage:");scanf("%d",&p[i]->age) ; printf("\nnative:");scanf("%s",p[i]->native) ; printf("\ntele:");scanf("%s",p[i]->tele) ; printf("\nemail:");scanf("%s",p[i]->email) ; p[i+1]=(struct student*)malloc(LEN); p[i]->next=p[i+1]; } p[0]->next=p[1]; p[i]->next=NULL; } void output() { int i; if(p[0]==0){printf("\nno information!\n");} else for(i=0;inum); printf("\nname: %s",p[i]->name); printf("\nsex: %s",p[i]->sex); printf("\nage: %d",p[i]->age); printf("\nnative: %s",p[i]->native); printf("\ntele: %s",p[i]->tele); printf("\nemail: %s\n",p[i]->email); }; } void exit() { printf("thanks to use this program!") ; }

推荐阅读
图文推荐