4.2 Matrix Sequencing Experiment

Source: Internet
Author: User

#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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.