33,311
社区成员
发帖
与我相关
我的任务
分享
char *str = "青年杂志(上半年)";
char str[] = "青年杂志(上半年)";
int main()
{
char *str = "青年杂志(上半年)";
char str1[] = "青年杂志(上半年)";
int nLen = strlen(str);
char Temp[4];
for (int i=0; i<nLen; i=i+2)
{
memcpy(Temp, str+i, 2);
Temp[2]='\0';
cout << Temp;
}
cout << endl;
for (int j=0; j<nLen; j=j+2)
{
memcpy(Temp, str1+j, 2);
Temp[2]='\0';
cout << Temp;
}
cout << endl;
cout << str << "," << str1 << endl;
return 0;
}
在VC6下,测试没问题。