parent
ad191d07f6
commit
dfba7381b6
@ -0,0 +1,41 @@
|
|||||||
|
void end_money() {
|
||||||
|
int m,minute,hour;
|
||||||
|
char xuehao;
|
||||||
|
printf("请输入学号:");
|
||||||
|
scanf("%ld",&xuehao);
|
||||||
|
for(m = 0; m < i; m++)
|
||||||
|
{
|
||||||
|
if(student[m].xuehao==xuehao)
|
||||||
|
{
|
||||||
|
printf("请输入%ld的下机时间:",xuehao);
|
||||||
|
scanf("%d:%d",&student[m].end.hour,&student[m].end.minute);
|
||||||
|
if(student[m].end.minute<student[m].begin.minute)
|
||||||
|
{
|
||||||
|
minute=student[m].end.minute+60
|
||||||
|
-student[m].begin.minute;
|
||||||
|
hour=student[m].end.hour-1-student[m].begin.hour;
|
||||||
|
student[m].time_hour = hour;
|
||||||
|
student[m].time_minute = minute;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minute=student[m].end.minute -student[m].begin.minute;
|
||||||
|
hour=student[m].end.hour -student[m].begin.hour;
|
||||||
|
student[m].time_hour = hour;
|
||||||
|
student[m].time_minute = minute;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(minute > 0)
|
||||||
|
{
|
||||||
|
hour = hour + 1;
|
||||||
|
printf("上机时间为:%d:%d 费用为:%d",student[m].time_hour,student[m].time_minute,hour);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("上机时间为:%d:%d\n 费用为:%d",student[m].time_hour,student[m].time_minute,hour);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
save();
|
||||||
|
printf("\n"); system("pause");
|
||||||
|
system("cls");
|
||||||
|
}
|
@ -1,38 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<string.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
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();
|
|
||||||
|
|
||||||
void save()
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
int m;
|
|
||||||
|
|
||||||
fp=fopen("ѧÉú»ú·¿¹ÜÀí.txt","w");
|
|
||||||
for(m=0;m<i;m++)
|
|
||||||
{
|
|
||||||
fprintf(fp,"%ld %s %s %d %d %d %d %d %d %d %d\n",student[m].xuehao,student[m].banji,student[m].name,student[m].begin.hour,student[m].begin.minute,student[m].end.hour,student[m].end.minute,student[m].time_hour,student[m].time_minute);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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<i;m++)
|
|
||||||
if(student[m].xuehao==xuehao)break;
|
|
||||||
for(;m<i;m++) student[m]=student[m+1];
|
|
||||||
}
|
|
||||||
save();
|
|
||||||
printf("\n");
|
|
||||||
system("pause");
|
|
||||||
system("cls");
|
|
||||||
}
|
|
Loading…
Reference in new issue