c++输入两串字符 将两个字符连接起来字符可带空格

#include<iostream>
#include<cstring>
using namespace std;
char * mystract(char *to,char *from)
{
	char *p,*q;
	p=to;
	while(*p!='\0')
	{
		p++;
	}
	q=from;
	while(*q!='\0')
	{
		*p=*q;
		p++;
		q++;
	}
  *p='\0';
  return to; 
}
int main()
{
	char t[10000],s[1000];
	cin.getline(t,100);
cin.getline(s,100);
	cout<<mystract(t,s);
	
	return 0;
		
}

おすすめ

転載: blog.csdn.net/qq_53336225/article/details/111827512