请问这道C语言错在哪

[复制链接]
查看11 | 回复3 | 2012-10-12 17:49:28 | 显示全部楼层 |阅读模式
下面是帮你修改后的代码#includestruct student{int xuehao;
//学号不能用小数(float类型) 如果觉得int不够用,就用longchar name[10];
//姓名数组float chengji[3];
//成绩应该用小数(float类型), 你的本意也是这样的吧}stu[3];int main() { float x1,x2,x3,x4=0;
//4个float型变量 分别用来保存三科成绩和总成绩int i,j;for (i=0;i#includestruct student{float xuehao; char name [10]; float chengji[3];}stu[3]; void main() { float x1,x2,x3,x4=0.0;int i,j...
回复

使用道具 举报

千问 | 2012-10-12 17:49:28 | 显示全部楼层
//scanf ("%f%c",&stu.xuehao,&stu.name);这句你最好分成两句scanf ("%f",&stu.xuehao);scanf ("%s" , stu.name); //字符串用%s输入输出printf ("%f%s%f",stu.xuehao,stu.name,x4);...
回复

使用道具 举报

千问 | 2012-10-12 17:49:28 | 显示全部楼层
scanf ("%d%d%d",&x1,&x2,&x3);你定义的是float所以是scanf ("%f%f%f",&x1,&x2,&x3);...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行