1、书面作业_13:1. 在主函数中定义一个 5 行 50 列的字符数组,然后调用两个函数进行处理:(1)void dubble_sort(char(*p)50,int n):对字符串进行冒泡排序(从小到大);(2)void print(char(*p)50,int n):输出排序后的字符串;程序运行如下图所示,请编程实现:#include#includeint main( ) void dubble_sort (char(*p)50,int m);void print(char(*p)50,int n);int i;char (*p)50;char name550=“Follow me-“,“B
2、asicStudy“,“Great Wall“,“FORTRAN-“,“computer-“;p=name;printf(“before sorted:n-n“);for(i=0; i0)strcpy(temp, pj);strcpy(pj, pj+1);strcpy(pj+1, temp);void print(char(*p)50,int n)int i;printf(“nafter sorted:n-n“);for(i=0; i#includeint main( ) void dubble_sort (char *p,int m);void print(char *p,int n);in
3、t i;char *p=“Follow me-“,“BasicStudy“,“Great Wall“,“FORTRAN-“,“computer-“;printf(“before sorted:n-n“);for(i=0; i0)temp=pj;pj=pj+1;pj+1=temp;void print(char *p,int n)int i;printf(“nafter sorted:n-n“);for(i=0; i #include #include #define N 20#define M 10void Max_pos(int arrayM, int n, int *prow, int *
4、pcol) int i,j,max = array00;for(i = 0; i max) max = arrayij;*prow = i;*pcol = j;void ReadDat(int aM,int n) int i,j;for(i = 0;i n;i+) for(j = 0; j M; +j) aij = (unsigned)rand()%51 + 50;void WriteDat(int aM,int n) int i,j;for(i = 0;i n; i+) for(j = 0 ; j M; +j)printf(“%5d“,aij);printf(“n“);int main(int argc,char *argv) /主÷函数簓,?调獭用?以?上?函数簓int aNM,prow,pcol;srand(unsigned)time(NULL);ReadDat(a,N);WriteDat(a,N);Max_pos(a,N,printf(“最?大洙值所ù在ú的?索÷引皔是?%d,%d。n“,prow,pcol);return 0;