下面这个程序怎么修改,使它能够达到要求?
例:该程序的部分运行结果是 3 4 6 2 32 233 4 6 1 2 5
可以自动排序吗?1 2 3 4 5 6
2 3 4 6 23 32
要求就是:(1)横排(从小到大自动排列)
(2)整体(以“1”开头的组合列完,接着是以“2”“3”...开头的列完)
#include <stdio.h>
int main()
{
int A[19]={3,4,6,7,8,9,11,13,14,15,16,18,19,20,24,27,28,29,33};
int B[12]={1,2,10,12,17,21,22,25,26,30,31,32};
int C[2]={5,23};
int i, j, k, m, n, p;
int cont=0;
for (i = 0; i < 19; i++) {
for (j = 0; j < 19; j++)
if (j != i)
for (k = 0; k < 19; k++)
if (k != i && k != j)
for (m = 0; m < 12; m++)
for (n = 0; n < 12; n++)
if (n != m)
for (p = 0; p < 2; p++) {
printf("%d %d %d %d %d %d\n", A[i], A[j], A[k], B[m], B[n], C[p]);
cont++;
}
}
printf("%d\n", cont);
return 0;
}