评委评分

462.#include<iostream>

463.using namespace std;
464.double main()
465.{int a[10];
466.int k[10];
467.int max,min,t,i,j,m,sum=0;
468.double average;
469.cout<<"评委的评分是:";
470.for(i=0;i<10;i++)
471.cin>>a[i];
472.max=a[0];
473.min=a[0];
474.for(i=0;i<10;i++)
475.{sum+=a[i];
476.if(a[i]>max)
477.{t=a[i];a[i]=max;max=t;}
478.if(a[i]<min)
479.{t=a[i];a[i]=min;min=t;}
480.}
481.average=(sum-max-min)/8.0;
482.cout<<"最高分:"<<max<<'\n'<<"最低分:"<<min<<'\n'<<"平均分:"<<average<<endl;
483.for(i=0;i<10;i++)
484.{k[i]=a[i]-average;
485.if(k[i]<0)
486.k[i]=-k[i];
487.}
488.max=k[0];
489.j=0;
490.min=k[0];
491.m=0;
492.for(i=0;i<10;i++)
493.{if(k[i]>max)
494.{t=k[i];k[i]=max;max=t;j=i;}
495.if(k[i]<min)
496.{t=k[i];k[i]=min;min=t;m=i;}
497.}
498.cout<<"最差评委:"<<j<<'\n'<<"最好评委:"<<m<<endl;
499.return 0;
500.}

你可能感兴趣的:(评委评分)