填空题
有如下程序:
#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】 。
【参考答案】
J
热门
试题
填空题
若有以下程序:#include <iostream>using namespace std;class sample{int x;public:sample(){}void setx(int i){x=i;}friend iht fun(sample B[],int n){int m=0;for{int i=0;i<n;i++)if(B[i].x>m)m=B[i].x;return.m;}};int main ( ){sample A[10];int arr[]={90,87,42,78,97,84,60,55,78,65};for(int i=O;i<10;i++)A[i].setx(arr[i]);cout<<fun(A, 10)<<end1;return 0;}该程序运行后的输出结果是 【13】 。