|
|
|
|
void reduce()
|
|
|
|
|
{
|
|
|
|
|
int i=0,j,k,id;
|
|
|
|
|
FILE *fp1,*fp2,*ff;
|
|
|
|
|
ff=fopen("b.txt","r");
|
|
|
|
|
fscanf(ff,"%d",&j);
|
|
|
|
|
close(ff);
|
|
|
|
|
if((fp1=fopen("a.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open error");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&id);
|
|
|
|
|
while(!feof(fp1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp1,"%d%d%s%d%d%d%d",&student[i].id,&student[i].class,&student[i].name,&student[i].time_beginhour,&student[i].time_beginminute,&student[i].time_endhour,&student[i].time_endminute);
|
|
|
|
|
i++;
|
|
|
|
|
j=i;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp1);
|
|
|
|
|
for(i=0;i<=j;i++)
|
|
|
|
|
{
|
|
|
|
|
if(student[i].id==id)
|
|
|
|
|
k=i;
|
|
|
|
|
}
|
|
|
|
|
fp2=fopen("a.txt","w");
|
|
|
|
|
if(k==0)
|
|
|
|
|
{
|
|
|
|
|
for(i=1;i<=j;i++)
|
|
|
|
|
fprintf(fp2,"%d%d%s%d%d%d%d",student[i].id,student[i].class,student[i].name,student[i].time_beginhour,student[i].time_beginminute,student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
}
|
|
|
|
|
if(k>0)
|
|
|
|
|
{
|
|
|
|
|
for(i=0;i<k;i++)
|
|
|
|
|
fprintf(fp2,"%d%d%s%d%d%d%d",student[i].id,student[i].class,student[i].name,student[i].time_beginhour,student[i].time_beginminute,student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
for(i=(k+1);i<=j;i++)
|
|
|
|
|
fprintf(fp2,"%d%d%s%d%d%d%d",student[i].id,student[i].class,student[i].name,student[i].time_beginhour,student[i].time_beginminute,student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp2);
|
|
|
|
|
ff=fopen("b.txt","w");
|
|
|
|
|
fprintf(ff,"%d",j-1);
|
|
|
|
|
fclose(ff);
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
void classfind()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int class,i=0,j;
|
|
|
|
|
if((fp=fopen("a.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open error");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵİ༶\n");
|
|
|
|
|
scanf("%d",&class);
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%d%d%s%d%d%d%d",&student[i].id,&student[i].class,&student[i].name,&student[i].time_beginhour,&student[i].time_beginminute,&student[i].time_endhour,&student[i].time_endminute);
|
|
|
|
|
i++;
|
|
|
|
|
j=i;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<=j;i++)
|
|
|
|
|
{
|
|
|
|
|
if(student[i].class==class)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%d\n",student[i].id);
|
|
|
|
|
printf("<EFBFBD>༶<EFBFBD><EFBFBD>%d\n",student[i].class);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",student[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d\n",student[i].time_beginhour,student[i].time_beginminute);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d\n",student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
void idfind()
|
|
|
|
|
{
|
|
|
|
|
int id,i=0,j;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if((fp=fopen("a.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open error");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ѧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&id);
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%d%d%s%d%d%d%d",&student[i].id,&student[i].class,&student[i].name,&student[i].time_beginhour,&student[i].time_beginminute,&student[i].time_endhour,&student[i].time_endminute);
|
|
|
|
|
i++;
|
|
|
|
|
j=i;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<=j;i++)
|
|
|
|
|
{
|
|
|
|
|
if(student[i].id==id)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%d\n",student[i].id);
|
|
|
|
|
printf("<EFBFBD>༶<EFBFBD><EFBFBD>%d\n",student[i].class);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",student[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d\n",student[i].time_beginhour,student[i].time_beginminute);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d",student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
void namefind()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i=0,j;
|
|
|
|
|
char name[10];
|
|
|
|
|
if((fp=fopen("a.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open error");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",&name);
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%d%d%s%d%d%d%d",&student[i].id,&student[i].class,&student[i].name,&student[i].time_beginhour,&student[i].time_beginminute,&student[i].time_endhour,&student[i].time_endminute);
|
|
|
|
|
i++;
|
|
|
|
|
j=i;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<=j;i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(student[i].name,name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%d\n",student[i].id);
|
|
|
|
|
printf("<EFBFBD>༶<EFBFBD><EFBFBD>%d\n",student[i].class);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",student[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d\n",student[i].time_beginhour,student[i].time_beginminute);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>ʱ<EFBFBD>䣻%d:%d",student[i].time_endhour,student[i].time_endminute);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|