计数排序:员工年龄排序
原题在这里:
#include<stdio.h>
int Counter[100];
int SortEmployee()
{
int Count = 0;
int Index = 0;
int offset = 0;
int Input = 0;
while(scanf("%d",&Count) == 1)
{
offset = 0;
for (Index = 0; Index<100; ++Index)
{
Counter[Index] = 0;
}
for (Index = 0; Index<Count;++Index)
{
scanf("%d",&Input);
++Counter[ Input ];
}
for (Index = 1; Index<100; ++Index)
{
for(int i = 0; i<Counter[Index];++i)
{
//Output[offset++] = Index;
printf("%d ",Index );
}
}
printf("\n");
}
return 0;
}
int main(int argc, char const *argv[])
{
SortEmployee();
return 0;
}