摘要:
#include <iostream>using namespace std;int main(){ char ch1[10] = "ab"; char ch2[] = "abcdef"; strncat(ch1,ch2,3); //ababc 合并char类型的字符串,第三个参数是指需要合并的字符串个数 cout<<ch1<<endl; return 0;}//相对应的是string类的append成员函数的使用#include <iostream>#include <string>using 阅读全文
摘要:
#include <iostream>#include <string>using namespace std;int main(){ //char ch1[10] = "gh"; //char ch2[] = "abcdef"; //strncpy(ch1,ch2,6); //cout<<ch1<<endl; string str1="hello word"; //string str2="xianglingchuan"; //支持char字符串 //char st 阅读全文