不要与如何分割明智的字符串混淆,例如: 在C ++中分割字符串? 关于如何在c ++中将字符串拆分为多行,我有些困惑。 这听起来像一个简单的问题,但请举以下示例: #include <iostream> #include <string> main() { //Gives error std::string my_val ="Hello world, this is an overly long string to have" + " on just one line"; std::cout << "My Val is : " << my_val << std::endl; //Gives error std::string my_val ="Hello world, this …