我是子凡呀 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条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?