- A.125
- B.n/2
- C.n
- D.n+1
- A.6357
- B.6135
- C.1357
- D.691357
- A.软件过程不规范
- B.软件开发生产率低
- C.软件质量难以控制
- D.软件成本不断提高
- A.4 2 1 1
- B.0 0 0 8
- C.4 6 7 8
- D.8 8 8 8
- A.8,7,8,7
- B.7,8,7,8
- C.8,7,7,8
- D.7,8,8,7
下列给定程序中,函数proc的功能是:首先把b所指字符串中的字符按逆序存放,然后将str1所指字符串中的字符和Str2所指字符串中的字符,按排列的顺序交叉合并到str所指数组中,过长的剩余字符接在str所指数组的尾部。例如,当str1所指字符串中的内容为ABCDEFG,str2 所指字符串中的内容为1234时,str所指数组中的内容应该为A483C2D1EFG;而当str1所指字符串中的内容为1234,str2所指字符串中的内容为ABCEDFG时,str所指数组中的内容应该为1G2F31:4DCBA。
请修改程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include
#include
#include
#include
void proc(char*strl,char*str2,char*str) {
int i,j;char ch;
i=0;j=strleu(str2)-1;
//****found****
while(i>j)
{
ch=str2[i];str2[i]=str2[j];str2[j]=ch;
i++;j--;
}
while(*str1||*str2)
{
if(*str1){*str=*str1;str++;str1++;)
if(*str2){*str=*str2;str++;str2++;)
}
//****found****
*str=0:
}
void main
{
char s1[100],s2[100],t[200];
system("CLS");
printf("\nEnter s1 string:");
scanf("%s",sl);
printf("\nEnter s2 string:");
scanf("%s",s2);
proc(s1,s2,t);
printf("\nThe result is:%s\n",t);
}
订单号:
遇到问题请联系在线客服
订单号:
遇到问题请联系在线客服