问答题
请编写函数proc(),该函数的功能是:将放在字符串数组中的M个字符串(每串的长度不超过N),按顺序合并组成一个新的字符串。
例如,若字符串数组中的M个字符串为:
【参考答案】
void proc(char arr[M][N], char*b)
{
int i, j, k=0;......
(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
n>1
点击查看答案
填空题
下列给定的程序中,函数proc()的功能是:用选择法对数组中的m个元素按从小到大的顺序进行排序。 例如,排序前的数据为:11 32 -5 2 14 则排序后的数据为:-5 2 11 14 32 请修改程序中的错误,使它能得到正确结果。 注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #define M 20 void proe(int a[], int n) int i, j, t, p; ************found************* for(j=0; j<n=1; j++); p=j; for(i=j; i<n; i++) if(a[i]<a[p]) p=i; t=a[p]; a[p]=a[j]; ************found************* a[p]=t; void main() int arr[M]=11, 32, -5, 2, 14, i, m=5; printf( 排序前的数据: ); for(i=0; i<m; i++) printf( %d , arr[i]); printf( n ); proc(art, m); printf( 排序后的顺序: ); for(i=0; i<m; i++) printf( %d , arr[i]); printf( n );
点击查看答案&解析
相关试题
n==1
n-1