我是子凡呀 2017-10-19 05:23 采纳率: 100%
浏览 902
已采纳

大家帮忙看一看 很急的

这个作业做的程序 为什么输入数据之后 加权平均分是一大堆数字串 好多位的数 还是个负的
#include
void main()
{
int A,B,C,D,E,F,G,H,I,J,K,L;
float a,b,c,d,e,f,g,h,i,j,k,l;

printf ("Please input your calculas scores:");
scanf ("%d",&A);
printf ("Please input your credit scores:");
scanf ("%f",&a);

printf ("Please input your circuit scores:");
scanf ("%d",&B);
printf ("Please input your credit scores:");
scanf ("%f",&b);

printf ("Please input your linea scores:");
scanf ("%d",&C);
printf ("Please input your credit scores:");
scanf ("%f",&c);

printf ("Please input your military theory scores:");
scanf ("%d",&D);
printf ("Please input your credit scores:");
scanf ("%f",&d);

printf ("Please input your physics scores:");
scanf ("%d",&E);
printf ("Please input your credit scores:");
scanf ("%f",&e);

printf ("Please input your English scores:");
scanf ("%d",&G);
printf ("Please input your credit scores:");
scanf ("%f",&g);

printf ("Please input your physical scores:");
scanf ("%d",&H);
printf ("Please input your credit scores:");
scanf ("%f",&h);

printf ("Please input your chemistry scores:");
scanf ("%d",&I);
printf ("Please input your credit scores:");
scanf ("%f",&i);

printf ("Please input your philosophy scores:");
scanf ("%d",&J);
printf ("Please input your credit scores:");
scanf ("%f",&j);

printf ("Please input your computer science scores:");
scanf ("%d",&K);
printf ("Please input your credit scores:");
scanf ("%f",&k);

printf ("Please input your history scores:");
scanf ("%d",&L);
printf ("Please input your credit scores:");
scanf ("%f",&l);

float sum1,sum2;

float w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12;

sum1=a+b+c+d+e+f+g+h+i+j+k+l;
w1=a/sum1;
w2=b/sum1;
w3=c/sum1;
w4=d/sum1;
w5=e/sum1;
w6=f/sum1;
w7=g/sum1;
w8=h/sum1;
w9=i/sum1;
w10=j/sum1;
w11=k/sum1;
w12=l/sum1;
sum2=A*w1+B*w2+C*w3+D*w4+E*w5+F*w6+G*w7+H*w8+I*w9+J*w10+K*w11+L*w12;

printf("credit:%6.2f,weighting total:%6.2f\n",sum1,sum2);

  • 写回答

7条回答 默认 最新

  • 我是子凡呀 2017-10-19 08:00
    关注

    真是让各位见笑了 我找到错误了图片说明

    少打了f的一段 麻烦各位了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退