#include <iostream>
#include <cstring> //strcat()函数,依赖于cstring
#include <string>
using namespace std;
int main() {
char str1[30], str2[20];
cout<<"Please input string1: ";
cin>>str1; //书中案例代码中忘了写cin
scanf("%s", str1); //gets()函数已经不支持了
cout<<"Please input string2:" ;
cin>>str2;
scanf("%s",str2);
strcat(str1, str2);
cout <<"Now the string1 is :" <<endl;
puts(str1);
}
《C++从入门到精通(第5版)》P118 实例7.5(fedora上修改)
最新推荐文章于 2024-09-20 19:53:19 发布