#include <stdio.h> #define M 4/****----------------------------------------------*****///function name: bubblessort (int list[], int n)//parameter: (incoming) int list[], array to be sorted//(incoming) int n, array length//function: Sort book order with bubbling Sort/****------------------------------ ----------------*****/void bubblessort (int list[], int n) {int I, j, K; for (i = 0, i < n-1; i++) {for (j = n-1; j > i; j--) {if (List[j]<list[j-1]) {//compare before and after size k = List[j]; LIST[J] = list[j-1]; List[j-1] = k; }}}}/****----------------------------------------------*****///function name: Display (int result[m][m])//Parameter: (incoming) int r ESULT[M][M], matrix result//function: Output matrix value/****----------------------------------------------*****/void Display (int result[m ][m]) {int I, J; printf ("The operating result of matrix:\n"); for (i = 0; i < M; i++) {for (j = 0; J < 4; J + +) {printf ("%d", result[i][j]); } printf ("\ n"); }}/***************Test program *************************/int Main () {int a[m][m]; int I, J; printf ("Input the data of matrix:\n"); for (i = 0; i < 4; i++) {for (j = 0; J < 4; J + +) {scanf ("%d", &a[i][j]); }} for (i = 0; i < M; i++) {Bubblessort (a[i], M); } Display (A);}
4.2 Matrix Sequencing Experiment