单选题
下面程序的输出结果是
____
。
#include<iostream>
#include<string>
using namespace std;
void main(){
charp1[10],p2[10];
strcpy(p1,"abc");
strcpy(p2,"ABC");
charstr[50]="xyz";
strcpy(str+2,strcat(p1,p2));
cout<<str;
}
【正确答案】
A
【答案解析】[解析] 本题考查字符串操作函数和指针的使用。strcat(p1,p2)将字符串p1和p2连接,接着调用strcpy函数,从数组str的第3个位置开始复制连接后的字符串,因此本题答案为 xyabcABC。