gpt4 book ai didi

c++ - 分离一个大字符串

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:54:09 27 4
gpt4 key购买 nike

你怎么说这样的话?

static const string message = "This is a message.\n
It continues in the next line"

问题是,下一行没有被识别为字符串的一部分..

如何解决?还是创建字符串数组然后初始化数组以保存每一行的唯一解决方案?

最佳答案

将每一行用引号括起来:

static const string message = "This is a message.\n"
"It continues in the next line";

编译器会将它们组合成一个字符串。

关于c++ - 分离一个大字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/945872/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com