📄 lt71.c
字号:
# include "stdio.h"
# define N 30
struct student_type
{ char name[8];
int num;
int age;
float score;
} stud[N];
void save()
{ FILE *fp;
int i;
if ((fp=fopen("st_score","wb"))==NULL)
{ printf("cannot open file\n");
return;
}
for (i=0;i<N;i++)
if (fwrite(&stud[i],sizeof(struct student_type),1,fp)!=1)
printf("file write error\n");
}
void main( )
{ int i;
for (i=0;i<N;i++)
scanf("%s%d%d%s",stud[i].name,&stud[i].num,&stud[i].age,stud[i].score);
save( );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -