//#include "stdafx.h"//vc++6.0加上这一行.
#include "stdio.h"
#include "math.h"
void main(void){
double a[10],ave,max,min,offset,x;
int i,j,k;
printf("Input the math scores of 10 students...\n");
for(i=0;i<10;scanf("%lf",a+i++));
for(ave=max=min=a[0],i=1;i<10;i++){
if(max max=a[i];
j=i;
}
else if(min>a[i]){
min=a[i];
k=i;
}
ave+=a[i];
}
printf("The max = %g pos = %d\nThe min = %g pos = %d\n",max,j,min,k);
printf("The ave = %g\n",ave/=10);
for(offset=100,i=0;i<10;i++)
if(offset>(x=fabs(a[i]-ave))){
offset=x;
j=i;
}
printf("The score is %g the subscript is %d\n",a[j],j);
for(i=0;i<10;i++){
for(k=i,j=k+1;j<10;j++)
if(a[k] if(k!=i){
x=a[i];
a[i]=a[k];
a[k]=x;
}
}
printf("Results from high to low is: ");
for(i=0;i<10;printf("%g ",a[i++]));
printf("\n");
}
#include"stdio.h"
main()
{ for(i=1;i<5;i++)
printf("i=%d"/n)
}