示例: 字符符号 = ".,-"; 字符stringg =“哈哈”;
输出: 哈哈, 哈哈。 哈哈-
如何使用 来实现这一点?
穿过&没出来 理想的。直舱壁
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
#include <iostream>
#include <string>
int main() {
std::string string1 = ",.;";
std::string string2 = "abc";
std::string output;
// Iterate over each character in string1
for (char ch : string1) {
// Concatenate string2 with the current character from string1
output += string2 + ch;
}
// Print the final output
std::cout << output << std::endl;
return 0;
}