switch(menu_select()) { case 1: readin();break; case 2: display(works);break; case 3: printf("delete all\n");break; case 4: printf("restore all\n");break; case 0: printf("goodbye\n");exit(0); default: printf("ok! please input again!\n");break; } } } int menu_select() { char s[2]; int cn;
do{ printf("input 1-4\n"); gets(s); cn=atoi(s); }while(cn<0||cn>4); return cn; } readin() { int i; char ch[10]; window(1,1,80,25); textbackground(15); textcolor(2); clrscr(); gotoxy(2,2); printf("Be prepare to input the information\n"); for(i=0;i<2;i++) { printf("number:");scanf("%s",works[i].num); printf("name:");getchar();gets(ch);strcpy(works[i].name,ch); printf("sex:");scanf("%s",works[i].sex); printf("age:");scanf("%d",&works[i].age); } printf("ok the input is over!!\n"); getch();
} display(struct worker p[2]) { int i;
char *c[4]={"number","name","sex","age"}; printf("%8s\t%8s\t%8s\t%8s\n",c[0],c[1],c[2],c[3]); for(i=0;i<2;i++) printf("%8s\t%8s\t%8s\t%8s\n",p[i].num,p[i].name,p[i].sex,p[i].age); } screen() { textmode(C80); textbackground(1); textcolor(15); clrscr(); window(1,1,80,1); { textbackground(15); textcolor(0); clrscr(); gotoxy(20,1); printf("The System Of Management Of Student"); } gotoxy(5,3); window(20,7,45,13); textbackground(4); clrscr(); window(21,7,44,13); textbackground(15); textcolor(0); clrscr(); gotoxy(1,1); printf("1.input the data\n"); gotoxy(1,2); printf("2.display the data\n"); gotoxy(1,3); printf("3.delete the data\n"); gotoxy(1,4); printf("4.restore the data\n"); gotoxy(1,5); printf("0.exit the system\n"); gotoxy(1,6); }