|
|
@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
|
|
|
#include<string.h>
|
|
|
|
|
|
|
|
#include<stdlib.h >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char id[20];
|
|
|
|
|
|
|
|
char name[20];
|
|
|
|
|
|
|
|
char _class[5];
|
|
|
|
|
|
|
|
char online[1];
|
|
|
|
|
|
|
|
float _fee;
|
|
|
|
|
|
|
|
float begin_hour;
|
|
|
|
|
|
|
|
float begin_min;
|
|
|
|
|
|
|
|
float end_hour;
|
|
|
|
|
|
|
|
float end_min;
|
|
|
|
|
|
|
|
}student[15];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dengji();
|
|
|
|
|
|
|
|
void shangji();
|
|
|
|
|
|
|
|
void fee();
|
|
|
|
|
|
|
|
void xiugai();
|
|
|
|
|
|
|
|
void chaxun();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i,k,m;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int select;
|
|
|
|
|
|
|
|
do
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("*****************欢迎进入机房收费管理系统*****************\n");
|
|
|
|
|
|
|
|
printf(" 1.学生登记\n");
|
|
|
|
|
|
|
|
printf(" 2.学生上机时间\n");
|
|
|
|
|
|
|
|
printf(" 3.学生下机时间及费用\n");
|
|
|
|
|
|
|
|
printf(" 4.修改学生信息\n");
|
|
|
|
|
|
|
|
printf(" 5.查询学生信息\n");
|
|
|
|
|
|
|
|
printf(" 6.退出系统\n");
|
|
|
|
|
|
|
|
printf("*****************欢迎进入机房收费管理系统*****************\n");
|
|
|
|
|
|
|
|
printf(" 请输入选项:");
|
|
|
|
|
|
|
|
scanf("%d",&select);
|
|
|
|
|
|
|
|
switch(select)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 1: getchar();
|
|
|
|
|
|
|
|
dengji();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2: getchar();
|
|
|
|
|
|
|
|
shangji();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 3:getchar();
|
|
|
|
|
|
|
|
fee();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 4:getchar();
|
|
|
|
|
|
|
|
xiugai();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 5:getchar();
|
|
|
|
|
|
|
|
chaxun();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 6: break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
}while(select!=6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dengji() //学生信息//
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
static int j=0;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("****************学生信息登记****************\n");
|
|
|
|
|
|
|
|
for(i=j;i<15;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char c;
|
|
|
|
|
|
|
|
printf("班级:");
|
|
|
|
|
|
|
|
gets(student[i]._class);
|
|
|
|
|
|
|
|
printf("学号:");
|
|
|
|
|
|
|
|
gets(student[i].id);
|
|
|
|
|
|
|
|
printf("姓名:");
|
|
|
|
|
|
|
|
gets(student[i].name);
|
|
|
|
|
|
|
|
printf("是否继续输入?(输入Y或N)");
|
|
|
|
|
|
|
|
scanf("%c",&c);
|
|
|
|
|
|
|
|
if(c=='N'||c=='n')
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
j=i+1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void shangji() //上机//
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char _id[20];
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("****************上机时间登记****************\n");
|
|
|
|
|
|
|
|
printf("请输入上机学生的学号:");
|
|
|
|
|
|
|
|
gets(_id);
|
|
|
|
|
|
|
|
for(i=0;i<15;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(strcmp(_id,student[i].id)==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("上机时间:");
|
|
|
|
|
|
|
|
scanf("%f:%f",&student[i].begin_hour,&student[i].begin_min);
|
|
|
|
|
|
|
|
printf("输入任意键返回上一级........\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(i==14)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf(" 该生信息未录入!\n");
|
|
|
|
|
|
|
|
printf(" 输入任意键返回上一级........\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void fee() //下机//
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char _id[20];
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("****************下机时间及费用登记****************\n");
|
|
|
|
|
|
|
|
printf("本机房每小时5元\n");
|
|
|
|
|
|
|
|
printf("输入下机学生学号:");
|
|
|
|
|
|
|
|
gets(_id);
|
|
|
|
|
|
|
|
for(i=0;i<15;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(strcmp(_id,student[i].id)==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(!(student[i].begin_hour&&student[i].begin_min))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("该生未上机!\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("下机时间:");
|
|
|
|
|
|
|
|
scanf("%f:%f",&student[i].end_hour,&student[i].end_min);
|
|
|
|
|
|
|
|
student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5;
|
|
|
|
|
|
|
|
printf("该生上网费用为:%.1f\n",student[i]._fee);
|
|
|
|
|
|
|
|
printf("输入任意键返回上一级........\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(i==14)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf(" 该生信息未录入!\n");
|
|
|
|
|
|
|
|
printf(" 输入任意键返回上一级........\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void chaxun() //查询//
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("*************************************学生信息查询*************************************\n");
|
|
|
|
|
|
|
|
printf("班级\t\t");
|
|
|
|
|
|
|
|
printf("学号\t\t");
|
|
|
|
|
|
|
|
printf("姓名\t\t");
|
|
|
|
|
|
|
|
printf("上机时间\t");
|
|
|
|
|
|
|
|
printf("下机时间\t");
|
|
|
|
|
|
|
|
printf("上机费用\t");
|
|
|
|
|
|
|
|
printf("在线状态\n");
|
|
|
|
|
|
|
|
for(i=0;i<15;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%s\t\t",student[i]._class);
|
|
|
|
|
|
|
|
printf("%s\t\t",student[i].id);
|
|
|
|
|
|
|
|
printf("%s\t\t",student[i].name);
|
|
|
|
|
|
|
|
printf("%g:%g\t\t",student[i].begin_hour,student[i].begin_min);
|
|
|
|
|
|
|
|
printf("%g:%g\t\t",student[i].end_hour,student[i].end_min);
|
|
|
|
|
|
|
|
printf("%.1f\t\t",student[i]._fee);
|
|
|
|
|
|
|
|
if(student[i].begin_hour==0)
|
|
|
|
|
|
|
|
printf("未上机");
|
|
|
|
|
|
|
|
else if(student[i].begin_hour!=0&&student[i].end_hour==0)
|
|
|
|
|
|
|
|
printf("在线");
|
|
|
|
|
|
|
|
else if(student[i].begin_hour!=0&&student[i].end_hour!=0)
|
|
|
|
|
|
|
|
printf("离线");
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("*************************************学生信息查询*************************************\n");
|
|
|
|
|
|
|
|
printf("\n\n输入任意键返回上一级!");
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void xiugai() //修改//
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char _id[20],name[20],banji[5];
|
|
|
|
|
|
|
|
int eh,em,n,bh,bm;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("****************修改学生信息****************\n");
|
|
|
|
|
|
|
|
printf("请输入要修改学生的学号:\n");
|
|
|
|
|
|
|
|
gets(_id);
|
|
|
|
|
|
|
|
for(i=0;i<15;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(strcmp(_id,student[i].id)==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("请选择要修改的内容:1:姓名 2:班级 3:上机时间 4:下机时间\n");
|
|
|
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
|
|
|
switch(n)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
printf("请输入新的姓名:\n");
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
gets(name);
|
|
|
|
|
|
|
|
strcpy(student[i].name,name);
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
printf("请输入新的班级:\n");
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
gets(banji);
|
|
|
|
|
|
|
|
strcpy(student[i]._class,banji);
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
printf("请输入新的上机时间:\n");
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
scanf("%d:%d",&bh,&bm);
|
|
|
|
|
|
|
|
student[i].begin_hour=bh;student[i].begin_min=bm;
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
printf("请输入新的下机时间:\n");
|
|
|
|
|
|
|
|
getchar();
|
|
|
|
|
|
|
|
scanf("%d:%d",&eh,&em);
|
|
|
|
|
|
|
|
student[i].end_hour=eh;
|
|
|
|
|
|
|
|
student[i].end_min=em;
|
|
|
|
|
|
|
|
student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5;
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|