一个C语言的关于文件的问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 20:00:51
为什么我运行后,却不能写入文件,请高手指点!!
#include<stdio.h>
#include<stdlib.h>
#define MAX 1
struct studentinformation /*define the struct*/
{
char name[10];
char num[10];
int score[3];
int average;
}stu[MAX];
void inputandaverage() /*define a function which can input values and get average values*/
{
int i,j;
stu[0].average=0;
for(i=0;i<MAX;i++)
{
printf("Please enter the number of the NO.%d student:\n",i+1);
scanf("%s",stu[i].num);
printf("Please enter the name of the NO.%d student:\n",i+1);
scanf("%s",stu[i].name);
for(j=0;j<3;j++)
{
printf("Please enter NO.%d score of NO.%d student:\n",j+1,i+1);
scanf("%d",&stu[i].score[j]);
stu[i].average+=stu[i].score[j];
}
stu[i].

没有给出全路径,这样在新建时出错了。但是我也不知道怎么没有提示,可能是被编译系统放临时的某些文件夹里去了吧!
#include<stdio.h>
#include<stdlib.h>
#define MAX 1
struct studentinformation /*define the struct*/
{
char name[10];
char num[10];
int score[3];
int average;
}stu[MAX];
void inputandaverage() /*define a function which can input values and get average values*/
{
int i,j;
stu[0].average=0;
for(i=0;i<MAX;i++)
{
printf("Please enter the number of the NO.%d student:\n",i+1);
scanf("%s",stu[i].num);
printf("Please enter the name of the NO.%d student:\n",i+1);
scanf("%s",stu[i].name);
for(j=0;j<3;j++)
{
printf("Please enter NO.%d score of NO.%d student:\n",j+1,i+1);
scanf("%d",&stu[i].score[j]);
stu[i].average+=stu[i].score[j];
}
stu[i].average=stu[i].average/3;
clrscr();
}
for(i=0;i<MAX;i++)