一个难解决的问题,please help!

yi519 2003-06-06 11:11:40
#include<stdio.h>
#include<stdlib.h>
struct student
{char name[10];
int num;
float score[3];
}b[3];
main()
{int i;
FILE *p;
printf("Input the message:\n");
for (i=0;i<3;i++)
scanf("%s%d%f%f%f",b[i].name,&b[i].num,&b[i].score[0],&b[i].score[1],&b[i].score[2]);
if((p=fopen("c:\\yi1.c\\yi2.c","w"))==NULL)
{printf("cannot open the file");
exit(0);}
for(i=0;i<3;i++)
fwrite(&b[i],sizeof(struct student),1,p);
fclose(p);
}
为什么编译不通过?

...全文
30 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
flab_lwq 2003-06-06
  • 打赏
  • 举报
回复
TC的bug
robertcarlos 2003-06-06
  • 打赏
  • 举报
回复
FILE *p; 是什么啊?
还有是什么环境啊?
plheart 2003-06-06
  • 打赏
  • 举报
回复
似乎结构体的定义有点问题
David2008 2003-06-06
  • 打赏
  • 举报
回复
在vc6.0中没有错
我编译过了
idontlikenickname 2003-06-06
  • 打赏
  • 举报
回复


程序没问题,检查你的编译环境的设置.

onion_535 2003-06-06
  • 打赏
  • 举报
回复
在main()前面加上void,scanf中的字符串改为"%s;%d;%f;%f;%f"后在vc6下没错误,执行也无误
yiyi999999999 2003-06-06
  • 打赏
  • 举报
回复
报什么错?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧