呵呵,我把输入的信息存到文件中了,如果还要编译下一个任务的话,是不是要再读出文件中的信息呢?要怎么读出啊??
#include <stdio.h>#include <stdlib.h>
struct Student
{char name[20];
char reason[20];
double money;
}record;
main()
{FILE *fp;
char ch;
int i,x;
printf("number:\n");
scanf("%d",&x);
for(i=0;i<x;i++)
printf("input student%d info\n",i+1);
if((fp=fopen("file1.dat","w"))==NULL)
{printf("Can't open this file1!\n");exit(0);}
printf("name reason money");
ch=getchar();
while(ch!='@')
{fputc(ch,fp); ch=getchar();
}fclose(fp);}