此例中使用两重循环来实现排序。但是值得注意的是以上程序执行时元素的交换并不都是必须的。 #include #include #define N 10void main(){ int i,j,t; int a[N]; clrscr(); for(i=0;i#include #define N 10void main(){ int i,j,t,k; int a[N]; clrscr();... Read More
posted @ 2007-01-16 09:15 齐心 Views(614) Comments(0) Diggs(0) Edit
如果右上角元素大于左下角元素,然后交换。输出经过处理后的右上角元素(含对角线) #include #include #define M 4#define N 4void main(){ clrscr(); int i,j; int a[M][N]={{13,22,33,44},{5,63,7,8},{91,10,11,12},{13,14,15,16}}; for(i=0;ia[j][i]) a[... Read More
posted @ 2007-01-16 09:08 齐心 Views(815) Comments(0) Diggs(0) Edit
#include #include #define M 4#define N 4void main(){ clrscr(); int i,k; int a[M][N]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; int b[M][N]; for(i=0;i#include #define M 4#define N 4void main(){ ... Read More
posted @ 2007-01-16 08:43 齐心 Views(1290) Comments(0) Diggs(0) Edit
#define N 5#include void main(){ int i,j,k,max,min; static int a[5]; for(i=0;ia[i]) {min=a[i];k=i;} } printf("max:a[%d]=%d,min:a[%d]=%d",j,max,k,min);} Read More
posted @ 2007-01-15 16:19 齐心 Views(3019) Comments(0) Diggs(0) Edit
#include #include void main(){ clrscr(); int i,j; int a[4][4]; for(i=0;i<4;i++) /**//*输入数据*/ for(j=0;j<4;j++) scanf("%d",&a[i][j]); for(i=0;i<4;i++) /**//*输出原始... Read More
posted @ 2007-01-15 16:16 齐心 Views(368) Comments(0) Diggs(0) Edit