求助,自己写的程序,但是有两个错误,求改正。谢啦
#include void main(void)
{
int i,n,s,x,y,N,sum;
int a=90,b=80,c=70,d=60,e=0;
int z1,z2,z3,z4,z5,z6,z7,z8,z9,z10;
printf("Input subject's numbers:");
scanf("%d",&n);
printf("Input the subject's scores:\n");
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&s);
if(x>=95,x<=100)
y=4.67;
else if (x>=90,x<=94)
y=4.33;
else if (x>=87,x<=89)
y=4.00;
else if (x>=84,x<=86)
y=3.67;
else if (x>=80,x<=83)
y=3.33;
else if (x>=77,x<=79)
y=3.00;
else if (x>=74,x<=76)
y=2.67;
else if (x>=70,x<=73)
y=2.33;
else if (x>=67,x<=69)
y=2.00;
else if (x>=64,x<=66)
y=1.67;
else if (x>=61,x<=63)
y=11.33;
else if (x=60)
y=1.00;
else if (x=a)
y=4.33;
else if (x=b)
y=3.33;
else if (x=c)
y=2.33;
else if (x=d)
y=1.00;
else y=0.00;
sum=sum+s;
{
switch(i)
{
case1: s*y=z1;break;
case2: s*y=z2;break;
case3: s*y=z3;break;
case4: s*y=z4;break;
case5: s*y=z5;break;
case6: s*y=z6;break;
case7: s*y=z7;break;
case8: s*y=z8;break;
case9: s*y=z9;break;
case10: s*y=z10;break;
}
}
程序代码:
#include void main(void) { int i,n,s,x,y,N,sum; int a=90,b=80,c=70,d=60,e=0; int z1,z2,z3,z4,z5,z6,z7,z8,z9,z10; printf("Input subject's numbers:"); scanf("%d",&n); printf("Input the subject's scores:\n"); for(i=1;i<=n;i++) { scanf("%d%d",&x,&s); if(x>=95,x<=100) y=4.67; else if (x>=90,x<=94) y=4.33; else if (x>=87,x<=89) y=4.00; else if (x>=84,x<=86) y=3.67; else if (x>=80,x<=83) y=3.33; else if (x>=77,x<=79) y=3.00; else if (x>=74,x<=76) y=2.67; else if (x>=70,x<=73) y=2.33; else if (x>=67,x<=69) y=2.00; else if (x>=64,x<=66) y=1.67; else if (x>=61,x<=63) y=11.33; else if (x=60) y=1.00; else if (x=a) y=4.33; else if (x=b) y=3.33; else if (x=c) y=2.33; else if (x=d) y=1.00; else y=0.00; sum=sum+s; { switch(i) { case1: s*y=z1;break; case2: s*y=z2;break; case3: s*y=z3;break; case4: s*y=z4;break; case5: s*y=z5;break; case6: s*y=z6;break; case7: s*y=z7;break; case8: s*y=z8;break; case9: s*y=z9;break; case10: s*y=z10;break; } } } N=(z1+z2+z3+z4+z5+z6+z7+z8+z9+z10)/sum; printf("%d",N); }
}
N=(z1+z2+z3+z4+z5+z6+z7+z8+z9+z10)/sum;
printf("%d",N);
}