?? exam12-12.cpp
字號:
/*文件名:exam12_12.cpp*/
#include <stdio.h>
main()
{
FILE *fp;
struct student
{
char name[10];
int score;
} stud;
int i=0;
if ((fp=fopen("stud.bin","rb"))==NULL)
{
printf("不能讀取stud.bin文件\n");
return;
}
printf("姓名 成績\n");
printf("----------\n");
while (1)
{
fread(&stud,sizeof(struct student),1,fp);
if (feof(fp)) break;
if (stud.score>=80)
printf("%s %d\n",stud.name,stud.score);
i++;
}
fclose(fp);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -