📄 sewinum.c
字号:
#include"jinhe.h"
void search_with_number()
{ FILE *fp;
int i;
long int num;
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 number you want to search:");
scanf("%ld",&num);
clrscr();
gotoxy(5,2);
printf("****************Computer technology and science 2 ban****************");
gotoxy(52,3);
printf("----number search----");
gotoxy(5,4);
printf("|-------------------------------------------------------------------|");
gotoxy(5,5);
printf("|--NUMBER--|-----NAME------|-SEX-|-ENGLI-|-COMPE-|-MATH-|-CPR-|-AVE-|");
gotoxy(5,6);
printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
for(i=0;;i++)
{ fread(&stu[i],LEN,1,fp);
if(stu[i].no==0)
{ clrscr();
gotoxy(5,10);
printf("Cannot find the student.");break;
}
if(stu[i].no==num)
{ gotoxy(5,7);
printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
gotoxy(5,8);printf("|");
gotoxy(16,8);printf("|");
gotoxy(32,8);printf("|");
gotoxy(38,8);printf("|");
gotoxy(46,8);printf("|");
gotoxy(54,8);printf("|");
gotoxy(61,8);printf("|");
gotoxy(67,8);printf("|");
gotoxy(73,8);printf("|");
gotoxy(6,8);printf("%ld",stu[i].no);
gotoxy(17,8);printf("%s",stu[i].name);
gotoxy(33,8);printf("%s",stu[i].sex);
gotoxy(39,8);printf("%.1f",stu[i].english);
gotoxy(47,8);printf("%.1f",stu[i].computer);
gotoxy(55,8);printf("%.1f",stu[i].maths);
gotoxy(62,8);printf("%.1f",stu[i].c_programe);
gotoxy(68,8);printf("%.1lf",stu[i].average);
gotoxy(5,9);printf("|----------|---------------|-----|-------|-------|------|-----|-----|");break;
}
}
fclose(fp);
gotoxy(29,10);
printf("Press any key to return.");
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -