save.1.c.c
来自「C语言成绩管理系统」· C语言 代码 · 共 38 行
C
38 行
#include "stdio.h"
struct student
{
char filename[10];
long number[10];
float score[100];
}stud;
main()
{
int i;
char filename;
long number;
float score;
FILE *fp;
struct student stud;
if((fp=fopen("c:\\filename.stud","w"))==NULL)
{
printf("Cannot open the file\n");
exit(1);
}
scanf("%s%s%s",&stud.filename[10],&stud.number[10],&stud.score[100]);
if((number==0))
{
printf("stop input ");
exit(1);
}
if(fread(&stud,sizeof(filename),7,fp)!=7)
{
printf("file read error\n");
exit(1);
}
getch();
fclose(fp);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?