这是我正在使用的常量,它是这样拆分的,因为我不想滚动我的编辑器
const string PROGRAM_DESCRIPTION = "Program will calculate the amount "
"accumulated every month you save, until you reach your goal.";
int main()
{
cout << PROGRAM_DESCRIPTION;
return 0;
}
当前在命令提示符中打印为
Program will calculate the amount accumulated every month you save,until you re
ach your goal.
当它打印出来时,我希望它打印在两行上,如下所示...
Program will calculate the amount accumulated every month you save,
until you reach your goal.
我不知道将 break 语句放在字符串中的什么位置,以便正确打印出来。
最佳答案
只需插入一个\n
字符就可以强制换行
const string PROGRAM_DESCRIPTION = "Program will calculate the amount "
"accumulated every month you save, \nuntil you reach your goal.";
关于c++ - 您可以在字符串文字中放置中断吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21634589/