From bef95a1dbd36e2a1992a64014d3fe220c68b6645 Mon Sep 17 00:00:00 2001 From: "1439768027@qq.com" <1439768027@qq.com> Date: Fri, 11 Jan 2019 16:57:30 +0800 Subject: [PATCH] 5 commit --- j1.cpp | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 194 insertions(+), 1 deletion(-) diff --git a/j1.cpp b/j1.cpp index a08dfee..2712fcf 100644 --- a/j1.cpp +++ b/j1.cpp @@ -1,6 +1,129 @@ +#include +#include +#include + +struct time { + int hour; + int minute; +}; + struct Student { + long int xuehao; + char banji[10]; + char name[10]; + int time_hour; + int time_minute; + struct time begin,end; +} ; +struct Student student[30]; +static int i=0,j; +void save(); +void insert(); +void end_money(); +void delete_student(); +void select_xuehao(); +void select_name(); +void select_banji(); +void show(); +int main() { + int menu(); + int i; + for(;;) + { + printf("\t\t*******************菜单**************\n"); + printf("\t\t\n"); + printf("\t\t\n"); + printf("\t\t***************机房收费管理系统*******\n"); + printf("\t\t\n"); + printf("\t\t\n"); + printf("\t\t1.###############输入学生信息:########\n"); + printf("\t\t2.#################上机费用:##########\n"); + printf("\t\t3.################删除档案:###########\n"); + printf("\t\t4.################按学号查询:#########\n"); + printf("\t\t5.################按班级查询:#########\n"); + printf("\t\t6.################按姓名查询:#########\n"); + printf("\t\t7.################显示学生信息:#######\n"); + printf("\t\t8.##################退出系统:#########\n"); + printf("\n\n\n\n请在(1-8)之间选择功能:"); + scanf("%d",&i); + + switch(i) + { + case 1: + { + system("cls"); + insert(); + } + break; + case 2: + { + system("cls"); + end_money(); + } + break; + case 3: + { + system("cls"); + delete_student(); + } + break; + case 4: + { + system("cls"); + select_xuehao(); + } + break; + case 5: + { + system("cls"); + select_banji(); + } + break; + case 6: + { + system("cls"); + select_name(); + } + break; + case 7: + { + system("cls"); + show(); + } break; + case 8: + { + exit(0); + } + break; + } + } + printf("\n"); system("pause"); + + save(); + return 0; + +} +void insert() { + printf("请输入学号:"); + scanf("%ld",&student[i].xuehao); + + printf("请输入姓名:"); + scanf("%s",student[i].name); + + printf("请输入班级:"); + scanf("%s",student[i].banji); + + printf("请输入上机时间:"); + scanf("%d:%d",&student[i].begin.hour,&student[i].begin.minute); + i = i + 1; + printf("人数:%d",i); + j=i; + save(); + printf("\n"); system("pause"); + system("cls"); +} void end_money() { int m,minute,hour; - char xuehao; + long int xuehao; printf("请输入学号:"); scanf("%ld",&xuehao); for(m = 0; m < i; m++) @@ -39,6 +162,27 @@ void end_money() { printf("\n"); system("pause"); system("cls"); } +void delete_student() +{ + long int xuehao; + int m; + printf("请输入学号:"); + scanf("%ld",&xuehao); + if(i==1) +{ + if(student[m].xuehao==xuehao) + printf("没有数据!"); + } +else{ + for(m=0;m