字符串单个打印

来源:互联网 发布:海迅开料软件破解下载 编辑:程序博客网 时间:2024/05/15 14:09
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;
}