📄 sewisco.c
字号:
#include"jinhe.h"
void search_with_score()
{ FILE *fp;
int x,i=0,n=0,flag=0;
float score;
extern char filename[15];
struct student stu[M];
if((fp=fopen(filename,"rb"))==NULL)
{ clrscr();
gotoxy(15,15);
printf("Cannot open file.Please press any key return.");
getch();
return;
}
clrscr();
gotoxy(15,15);
printf("Please input the max score you want to search:");
scanf("%f",&score);
for(;;)
{ if(flag==1) break;
clrscr();
x=0;
gotoxy(5,2);
printf("****************Computer technology and science 2 ban****************");
gotoxy(29,3);
printf("--press enter to change the page and return--");
gotoxy(5,4);
printf("|-------------------------------------------------------------------|");
gotoxy(5,5);
printf("|--NUMBER--|-----NAME------|-SEX-|-ENGLI-|-COMPE-|-MATH-|-CPR-|-AVE-|");
gotoxy(5,6);
printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
for(;;)
{ fread(&stu[i],LEN,1,fp);
if(stu[i].no==0) { flag=1; break;}
if(stu[i].average<=score)
{ gotoxy(5,7+x);printf("|");
gotoxy(16,7+x);printf("|");
gotoxy(32,7+x);printf("|");
gotoxy(38,7+x);printf("|");
gotoxy(46,7+x);printf("|");
gotoxy(54,7+x);printf("|");
gotoxy(61,7+x);printf("|");
gotoxy(67,7+x);printf("|");
gotoxy(73,7+x);printf("|");
gotoxy(6,7+x);printf("%ld",stu[i].no);
gotoxy(17,7+x);printf("%s",stu[i].name);
gotoxy(33,7+x);printf("%s",stu[i].sex);
gotoxy(39,7+x);printf("%.1f",stu[i].english);
gotoxy(47,7+x);printf("%.1f",stu[i].computer);
gotoxy(55,7+x);printf("%.1f",stu[i].maths);
gotoxy(62,7+x);printf("%.1f",stu[i].c_programe);
gotoxy(68,7+x);printf("%.1lf",stu[i].average);
gotoxy(5,8+x);printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
x+=2;
i++;
if(++n%9==0)
{ getch();
break;
}
}
}
if(i%9==0)
{ clrscr();
gotoxy(5,15);
printf("This is the end! Press any key to Quit!");
}
}
fclose(fp);
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -