|
<p>求c语言问题 到底错哪了? 谢啦</p>
<p><img src="http://img.baidu.com/img/iknow/icn_point.gif"> 悬赏分:0 -</p>
<p>解决时间:2010-4-14 13:02</p>
<p># include <stdio.h></p>
<p>int main(void)</p>
<p>{</p>
<p>int i,n,grade;</p>
<p>int a,b,c,d,e;</p>
<p>printf("enter n:");</p>
<p>scanf("%d",&n);</p>
<p>for(i=1;i<=n;i++){</p>
<p>printf("enter grade %d:",i);</p>
<p>scanf("%d",&grade);</p>
<p>a=b=c=d=e=0;</p>
<p>if (grade%d,i<=59){</p>
<p>a=a+1;}</p>
<p>else if(grade%d,i<=69){</p>
<p>b++;}</p>
<p>else if(grade%d,i<=79){</p>
<p>c++;}</p>
<p>else if(grade%d,i<=89){</p>
<p>d++;}</p>
<p>else{</p>
<p>e++;}</p>
<p>}</p>
<p>printf("the number of A(90~100):%d\nthe number of B(80~89):%d\nthe number of C(70~79):%d\nthe number of D(60~69):%d\nthe number of E(0~59):%d\n",e,d,c,b,a);</p>
<p>return 0;</p>
<p>}</p>
<p>问题补充:</p>
<p>没分了,不然全给了!!</p>
<p>提问者: 花花千寻 - 一级</p>
<p>最佳答案</p>
<p>你是想某个分数段的个数吧 可以这样</p>
<p>#include <stdio.h></p>
<p>int main(void)</p>
<p>{</p>
<p>int i,n,grade;</p>
<p>int a,b,c,d,e;</p>
<p>printf("enter n:");</p>
<p>scanf("%d",&n);</p>
<p>a=b=c=d=e=0;</p>
<p>for(i=1;i<=n;i++)</p>
<p>{</p>
<p>printf("enter grade %d:",i);</p>
<p>scanf("%d",&grade);</p>
<p>if (grade<=59){</p>
<p>a=a+1;}</p>
<p>else if(grade<=69){</p>
<p>b++;}</p>
<p>else if(grade<=79){</p>
<p>c++;}</p>
<p>else if(grade<=89){</p>
<p>d++;}</p>
<p>else{</p>
<p>e++;}</p>
<p>}</p>
<p>printf("the number of A(90~100):%d\nthe number of B(80~89):%d\nthe number of C(70~79):%d\nthe number of D(60~69):%d\nthe number of E(0~59):%d\n",e,d,c,b,a);</p>
<p>return 0;</p>
<p>}</p>
<p>0</p>
<p>回答者:</p>
<p>1025794609a - 三级 2010-4-13 23:04</p>
<p>我来评论>></p>
<p>提问者对于答案的评价:</p>
<p>真的挺感谢的!终于明白了。。。感觉真好!呵呵。。</p>
|
|