• 实训室管理系统




    1
    /* 2 ============================================================================ 3 Name : 实训室管理系统.c 4 Author : 徐景祥 5 Version : 6 Copyright : All Right Restent 7 Description : Hello World in C, Ansi-style 8 ============================================================================ 9 */ 10 11 #include <stdio.h> 12 #include <stdlib.h> 13 #define SECRET 123456 14 //申请人结构体 15 struct applyer 16 { 17 int number;//学号 18 int class;//班级 19 char name[20];//名字 20 int class_num;//实训室编号 21 }; 22 23 struct applyer all_applyer[100] = {};//保存申请人的信息 24 void printf_all_applyers(); 25 int main(void) 26 { 27 puts(" 28 ****** ****** 29 ********** ********** 30 ************* ************* 31 ***************************** 32 ***************************** 33 ****!!!【欢迎进入实训室管理系统】!!!** 34 *************************** 35 *********************** 36 ******************* 37 *************** 38 *********** 39 ******* 40 *** 41 *"); 42 puts("--------------------------------------------------------------------"); 43 init_role(); //函数调用 44 return EXIT_SUCCESS; 45 } 46 /*选择系统登陆角色*/ 47 /*一、进入界面 48 * 1、申请者 1)输入申请人的信息(姓名、班级、申请的实训室号),2)把信息保存给管理员看 49 * 2、管理员 1)输入登陆密码(密码正确、密码错误) 2)查看申请人的信息 3)回复申请人 50 * 3、其他(提示输入有误) 51 * 52 */ 53 void init_role() 54 { 55 puts("请输入您登陆的身份(0代表申请者,1代表管理员):"); 56 fflush(stdout);//刷新缓冲区,用户输入信息之前必要的步骤 57 int role = 0; 58 scanf("%d",&role); //或者登陆身份0或1 或其他 三种情况 59 if(role == 0) 60 { 61 //申请者 62 63 64 puts("请输入您的姓名、班级、学号(空格隔开):"); 65 66 fflush(stdout);//刷新缓冲区,用户输入信息之前必要的步骤 67 struct applyer applyer_;// 68 scanf("%s%d%d",&applyer_.name,&applyer_.class,&applyer_.number);//申请人信息:姓名、班级、学号 69 puts("请选择要申请的实训室编号(1、2、3):"); 70 fflush(stdout);//刷新缓冲区,用户输入信息之前必要的步骤 71 int class_num = 1; 72 scanf("%d",&class_num); 73 if(class_num >= 1 && class_num<=3) 74 { 75 //保存信息给管理员看 76 applyer_.class_num=class_num;//把接受到的实训室编号赋值给结构体里面 77 save_applyer(applyer_);// 78 puts("恭喜恭喜,申请成功!等待管理员审核....."); 79 //return;//函数结束 80 init_role();//继续运用给管理员登陆,重复 81 } 82 83 } 84 else if(role == 1)//当输入1时,管理员 85 { 86 87 puts("请输入管理密码(8位以内数字):");//提示需要输入密码 88 fflush(stdout);//刷新缓冲区,用户输入信息之前必要的步骤 89 int secret = 0; 90 scanf("%d",&secret);//获取输入的密码 91 if(secret == SECRET)//判断输入的密码是否与正确的密码一致 92 { 93 //密码正确 94 puts("管理员你好!"); 95 fflush(stdout); 96 printf_all_applyers();//打印信息 97 puts("请输入您要审批的申请序号、操作:(0为通过,1为不通过)"); 98 fflush(stdout); 99 int id = 0,operation = 1; 100 scanf("%d%d",&id,&operation); 101 puts("操作成功"); 102 init_role(); 103 } 104 else 105 { 106 puts("您的输入有误,请重新输入!");//密码错误时的提示 107 } 108 } 109 else 110 { 111 puts("您输入有误!"); 112 } 113 114 } 115 /*保存申请人到数组里面*/ 116 117 void save_applyer(struct applyer aply) 118 { 119 int i; 120 for(i=0;i<100;i++) 121 { 122 if(all_applyer[i].number == 0) 123 { 124 all_applyer[i] = aply; 125 return; 126 } 127 } 128 } 129 //打印申请人的信息 130 //知识点:怎么打印结构体的内容??? 131 void printf_all_applyers() 132 { 133 134 int i; 135 for(i=0;i<100;i++)//用循环依次打印出来 136 { 137 if(all_applyer[i].number != 0)//结构体初始化为空,也就是为0,当判断不为0是,所以就赋值非0了,就可以打印里面的东西。等于0就是赋值了东西 138 { 139 printf("序号:%d 姓名:%s 班级:%d 申请的实训室:%d ",i,all_applyer[i].name,all_applyer[i].class,all_applyer[i].class_num); 140 } 141 } 142 }

     

  • 相关阅读:
    Java设计模式之单例模式
    Bootstrap-table使用footerFormatter做统计列
    Bootstrap进度条
    基于Bootstrap的表格插件bootstrap-table
    基于Bootstrap的对话框插件bootstrap-dialog
    基于Bootstrap的下拉框插件bootstrap-select
    JsonConfig处理日期时间
    Jquery表单验证插件validate
    Hibernate使用Criteria去重distinct+分页
    设置iframe高度自适应屏幕高度
  • 原文地址:https://www.cnblogs.com/kinson/p/7527036.html
Copyright © 2020-2023  润新知