有如下程序:
#include <iostream>
using namespace std;
int strle(char a[],char b[])

int num=O,n=O;
while (* (a+num) !=’/0’)
num++;
while (b [n] )

* (a+num)=b [n];
num++;
n++;

return(num);

int main ( )

char strl[80],str2[80],*p1=str1,*p2=str2;
cin>>p1;
cin>>p2;
cout<<strle(p1,p2)<<end1;
return 0;

运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是______。

有如下程序:
#include <iostream>
using namespace std;
int strle(char a[],char b[])

int num=O,n=O;
while (* (a+num) !=’/0’)
num++;
while (b [n] )

* (a+num)=b [n];
num++;
n++;

return(num);

int main ( )

char strl[80],str2[80],*p1=str1,*p2=str2;
cin>>p1;
cin>>p2;
cout<<strle(p1,p2)<<end1;
return 0;

运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是 【7】

阅读程序:
# include<string.h>
# include<strdio.h>
strle(char a[],char b[])
int num=0,n=0;
while(*(a+num)!=’0’)num+ +;
while(b[n])
* (a+num)=b[n];num+ +;n+ +;
return(num);

main( )
char strl[81],str2[81],* p1=strl,*p2=str2;
gets(p1);gets(p2);
prinf("%d/n",strle(p1,p2));

运行上面的程序,如果从键盘上输入字符串qwerty和字符串abcd,则程序的输出结果是 【14】

有如下程序: #include <iostream> using namespace std; int strle(char a[],char b[]) { int num=O,n=O; while (* (a+num) !=’/0’) num++; while (b [n] ) { * (a+num)=b [n]; num++; n++; } return(num); } int main ( ) { char strl[80],str2[80],*p1=str1,*p2=str2; cin>>p1; cin>>p2; cout<<strle(p1,p2)<<end1; return 0; } 运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是 【7】

微信扫码获取答案解析
下载APP查看答案解析