当前位置:文档之家› 宿舍管理系统c语言

宿舍管理系统c语言

#include"stdio.h"int main_menu_select() /*主菜单选择*/ {char s;printf("\n1 Administrator in charge of the students and books' information\n");printf("\n2 Administrator in charge of lend books\n");printf("\n3 Administrator in charge of receive books\n");printf("\n4 Student\n");printf("\n5 Guest\n");printf("\n6 exit\n\n");printf("\n input 1-6 to choice the function\n");do{s=getche();printf("\n");}while(s<49||s>54);return s;}int administrator_menu_select() /*管理员菜单选择*/ {int s;printf("input 1-6 to choice the function\n");printf("1 input the information of books\n");printf("2 recompose the information of the books\n");printf("3 cancel the information of books \n");printf("4 input the information of students\n");printf("5 recompose information of the students\n");printf("6 cancel the information of students\n");printf("7 return main menu\n");printf("8 exit\n\n" );do{s=getche();printf("\n");}while(s<49||s>56);return s;}hello_main() /*返回主菜单*/ {for(; ;){switch(main_menu_select()){case 49:adm_information();break;case 51:printf("hellooo");break;case 52:printf("helloooo");break;case 53:printf("hellooooo");break;case 54:printf("Goodbye!");exit(0);}}}hello_adm_menu() /*返回管理员功能选择菜单*/ {for(; ;){switch(administrator_menu_select()){case 49:books_information_input();break;case 50:printf("Student\n");break;case 51:printf("Guest\n");break;case 52:students_information_input();break;case 53:printf("Guest of gentleman\n");break;case 54:printf("hahha");break;case 55:hello_main();break;case 56:printf("Goodbye!");exit(0);}}}struct /*图书结构体*/ {int number;char name[20];char press[20];char writer[20];int price;}books[200];struct /*学生结构体*/ {int number;char name[20];char sex[6];int grade;}students[200];adm_information() /*管理员菜单*/ {for(; ;){switch(administrator_menu_select()){case 49:books_information_input();break;case 51:printf("Guest\n");break;case 52:students_information_input();break;case 53:printf("Guest of gentleman\n");break;case 54:printf("hahha");break;case 55:hello_main();break;case 56:printf("Goodbye!");exit(0);}}}int books_information_input() /*图书信息输入函数*/ {int m,i,s;char h;printf("input the number of the books you want to operate:");scanf("%d",&m);for(i=1;i<m+1;i++){printf("please input the %dth book's number:",i);scanf("%d",&books[i].number);printf("\n please input the %dth book's name:",i);scanf("%s",books[i].name);printf("\n please input the %dth book's press:",i);scanf("%s",books[i].press);printf("\n please input the %dth book's writer:",i);scanf("%s",books[i].writer);printf("\n please input the %dth book's price:",i);scanf("%d",&books[i].price);printf("\n\n");}printf("\ninformation of the students has been inputed\n");printf("1 to return higher menu\n"); /*返回上一级菜单,即管理员选择功能菜单*/h=getche();if(h==1)hello_adm_menu();}students_information_input() /*学生信息输入函数*/ {int m,i,s;printf("input the number of the students you want to operate:");scanf("%d",&m);for(i=1;i<m+1;i++){printf("\nplease input the %dth student's number:",i);scanf("%d",&students[i].number);printf("\n please input the %dth student's name:",i);scanf("%s",students[i].name);printf("\n please input the %dth student's sex:",i);scanf("%s",students[i].sex);printf("\n please input the %dth student's grade:",i);scanf("%d",&students[i].grade);}printf("\ninformation of the books has been inputed\n\n"); }main(){for(; ;){switch(main_menu_select()){case 49:adm_information();break;case 50:printf("helloo");break;case 51:printf("hellooo");break;case 52:printf("helloooo");break;case 53:printf("hellooooo");break;case 54:printf("Goodbye!");exit(0);}}}。

相关主题