level 1
#include
#include
int main(int argc, char *argv[]){struct {long num; char name[20]; float score1; float score2; float score3; }stu[50]; int i; float x1,x2,x3; for(i=0;i<50;i++) {scanf("%d,%s",&stu[i].num,stu[i].name); scanf("%f,%f,%f",&x1,&x2,&x3); stu[i].score1=x1,stu[i].score2=x2,stu[i].score3=x3; } for (i=0;i<50;i++) stu[i].total=stu[i].score1+stu[i].score2+stu[i].score3, for(i=0;i<50;i++) printf("%1d%name%f\n"stu[i].num,stu[i].name,stu[i].total) system("PAUSE"); return 0;}
2004年11月08日 05点11分
1
level 7
#include
#include
int main(int argc, char *argv[]){struct {long num; char name[20]; float score1; float score2; float score3;float total; }stu[50]; int i; float x1,x2,x3; for(i=0;i<50;i++) {scanf("%ld,%s",&stu[i].num,stu[i].name); scanf("%f,%f,%f",&x1,&x2,&x3); stu[i].score1=x1;stu[i].score2=x2;stu[i].score3=x3; } for (i=0;i<50;i++) stu[i].total=stu[i].score1+stu[i].score2+stu[i].score3; for(i=0;i<50;i++) printf("%1d %s %f\n",stu[i].num,stu[i].name,stu[i].total); system("PAUSE"); return 0;} --------------------嘿嘿,还是要细心啊,别逗号分号分不清,
2004年11月08日 05点11分
2
level 1
倒数第四,第六行有问题,不过运行结果很奇怪,我是用DEVCPP的ASSISS不在,VC99解释一下,头函数的用法
2004年11月08日 05点11分
3
level 7
倒数第6行:stu[i].total=stu[i].score1+stu[i].score2+stu[i].score3,1.你没定义stu.total2.语句结束你用了逗号...倒数第4行:printf("%1d%name%f\n"stu[i].num,stu[i].name,stu[i].total)1.%name是什么格式?2.语句结束的分号丢了........3.还有一个小毛病是这么输出一大片,怕你自己也不知道都是什么了,
2004年11月08日 05点11分
5
level 1
%name,是书上的我也想用%s的,运行结果是0.00000$$2.000001.00000我只输入三个数字.这个运行有问题吗?
2004年11月08日 05点11分
6
level 7
书错了!要对自己有信心!你只输入3个数字?怎么输入的??你第一个输入的整数将赋值给stu.num你第二个回车前输入的字符(前20个)将作为stu.name然后你要输入如下:1.0,3.0,4.0
注意,这里逗号必须也要有这样你才输入了第一个纪录,要重复50次,才能全部输入纪录。做测试一个也可以。按我修改的,估计是你输入数据错误
2004年11月08日 06点11分
7
level 1
我第一输入001第二输入 LI然后就出来一大串数字
2004年11月08日 06点11分
8
level 7
不对。你要这么输入:1,li
1,2,3
这样才算输入了一个stu数据
2004年11月08日 06点11分
9
level 0
输入LI以后;16 0.000002299916 ?0.0000022933990?0.000000200039789?0.0000004011872 0.0000000
2004年11月08日 06点11分
11
level 1
我那电脑特怪,只有ASSISS知道,我运行的是你的程序,你用的是DEVCPP吗?
2004年11月08日 06点11分
13
level 7
我用MinGW,那你等他来了问吧,不过我看不是你电脑奇怪,呵呵,同样的c代码,这里又没有那些和硬件有关的东东,天下的电脑都一样,呵呵,我给你说了是你输入数据时候格式不对......不说了,你等他吧,
2004年11月08日 07点11分
14
level 1
ok了是我LI前没加1Thank you vc99!
2004年11月08日 07点11分
15
level 9
嘿嘿.我说的么.不可能就那么奇怪的电脑.我这么多年也没见到过..要真的有,那我还真得跑上海去看看......比化石还要珍贵啊......茉莉的粗心不是一回两回了,得好好改改了..
2004年11月08日 08点11分
16
level 1
Welcome to Shanghai,assiss!马上就要考试了,请你们出几道题目,让我练习!不要太难,我是初级的.
2004年11月09日 03点11分
17
level 1
那我去参考书上的题目吧!你今天没去挖化石啊?你现在应该在显微镜下吧!有机会给我讲讲克隆技术!哈哈..................
2004年11月09日 04点11分
19