字符串函数的使用

在打一个字符串中间插入第二个字符串。

#include <bits/stdc++.h>

using namespace std;

int main() {
        int n;  
        string s1,s2;    
        cin >> n;    
        while (n--)    
        {        
            int L;    
            cin >> s1 >> s2;        
            L=s1.length();        
            s1.insert(L/2,s2);        
            cout << s1 << endl;        
            s1.erase();        
            s2.erase();
	}        
return 0;
}
发布了8 篇原创文章 · 获赞 0 · 访问量 147

猜你喜欢

转载自blog.csdn.net/weixin_46130146/article/details/104074968