C++编程高手们请进!!

来源:百度知道 编辑:UC知道 时间:2024/06/05 16:21:45
由于刚学C++,对于基数排序不是很了解,我在网上搜索的基数排序算法大多不能运行而且很复杂,很少有解释,所以恳求高手们给一个基数排序算法的源码,比如要排序 {123,22,43,56,222,2},括号内的仅供参考。多谢了!注意:我需要的是一个可运行的基数排序算法的源码,而不是其它,请高手们理解!不要只发表看法而没有算法!谢谢!

#define maxsize 20
#include<conio.h>
typedef struct {
int key;
}rcdtype;
typedef struct {
rcdtype r[maxsize+1];
int length;
}sqlist;

/*表的创建*/
void create(sqlist *l)
{int i;
printf("\nTo create a list,tell me the length:");
scanf("%d",&l->length);
printf("Now input the list:");
for(i=1;i<=l->length;i++)
scanf("%d",&l->r[i].key);
}
/*表的输出*/
void play(sqlist l)
{int i;
printf("The list is:");
for(i=1;i<=l.length;i++)
printf("%d ",l.r[i].key);
}
/*基数排序*/
#define max_num_of_key 8
#define radix 10
#define max_space 100
typedef struct{
char keys[max_num_of_key];
int next;
}slcell;
typedef struct{
slcell r[max_space];
int keynum;
int recnum;
}sllist;
typedef int arraytype[radix];
void tran