|
发表于 2013-3-23 17:24:34
|
显示全部楼层
#include<stdio.h>
#include<stdlib.h>
#include<stdio.h>
int Iuput_score(int score[],int w)
{
int i;
for(i=0;i<w;i++)
scanf("%d",&score[i]);
if(score== -1)
return i;
}
void Output_score(int score[],int n)
{
int i;
for(i=0;i<n;i++)
printf("%5d",score[i]);
printf("%d\n",n);
}
void store_score(int score[],int n)
{
int i,j,k;
for(i=0;i<n-1;i++)
for(j=0;j<n;j++)
if(score[j]<score[i])
{
k=score[i];
score[i]=score[j];
score[j]=k;
}
}
void main()
{
int score[30],n,w;
printf("请输入你要统计的人数:");
scanf("%d",&w);
printf("please enter the gardes:\n");
n=Iuput_score(score,w);
store_score(score,n);
Output_score(score,n);
}
数组没有输入没有那个下表 我改了一下 可以用了
排序也有点问题 |
|