I haven't found the mistake
Nov 10, 2012 at 10:46am UTC
I just write a new program. It can run, but it doesn't output the true number. Here are some of the codes:
input codes:(ck means subject NO. and cj means grades)
1 2 3 4 5 6 7 8 9 10 11
int where=-1;
do
{
where++;
cin>>cj[kc][where];
if (where>=100)
{
cout<<"too much numbers!\n" ;
break ;
}
}while (cj[0][where]>=0);
output codes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
case 'M' :
s=cj[kc][0];
for (i=0;i<100&&cj[kc][i]>=0;i++)
{
if (cj[kc][i]>=s)
s=cj[kc][i];
}
cout<<"Highest score:" <<s<<endl;
break ;
case 'L' :
s=100;
for (i=0;i<100&&cj[kc][i]>=0;i++)
{
if (cj[kc][i]<s)
s=cj[kc][i];
}
cout<<"Minimum fraction:" <<s<<endl;
break ;
case 'P' :
s=j=0;
for (i=0;i<100&&cj[kc][i]>=0;i++)
{
if (cj[kc][i]>=60)
s++;
else
j++;
}
cout<<"Pass ratio:" <<(int )(s*100/(s+j))<<"%" <<endl;
break ;
case 'E' :
s=j=0;
for (i=0;i<100&&cj[kc][i]>=0;i++)
{
if (cj[kc][i]>=85)
s++;
else
j++;
}
cout<<"Excellent proportion:" <<(int )(s*100/(s+j))<<"%" <<endl;
break ;
output:
Nov 10, 2012 at 11:45am UTC
I don't see where your output is produced. All the above code has a string, such as "Pass ratio:".
This line in the input section made me hesitate:
I wondered whether it should have been
}while (cj[kc ][where]>=0);
Nov 11, 2012 at 5:19am UTC
I just want to tell you that the output number is not true. You know, I can't copy the output string, so I just enter the numbers to show to you.
Topic archived. No new replies allowed.