我在这里搞砸了什么?代码中不能有硬编码值,这就是为什么我的所有提示都是常量的原因。我们还必须调用用户定义的函数来验证输入。
我在编译时收到以下错误 - 对 WinMain 的未定义引用,[错误] Id 返回 1 个退出状态我使用 Dev C++ 作为 IDE
#include <iostream> //for I/O
#include <iomanip> //for formatting output
using namespace std;
const string PROGRAM_DESCRIPTION = "Program will calculate the amount "
"accumulated every month you save, \nuntil you reach your goal. ";
const string ENTER_DOLLAR_AMOUNT_MONTHLY = "Enter the dollar amount to be "
"saved each month: ";
int main()
{
double dollarSavedPerMonth;
//displays program description
cout << PROGRAM_DESCRIPTION << endl << endl;
//Prompts user to …Run Code Online (Sandbox Code Playgroud) 这是我正在使用的常量,它是这样拆分的,因为我不想滚动我的编辑器
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;
}
Run Code Online (Sandbox Code Playgroud)
目前在命令提示符下打印出来
Program will calculate the amount accumulated every month you save,until you re
ach your goal.
Run Code Online (Sandbox Code Playgroud)
当打印出来时,我希望它能在两条独立的线条上打印,如下所示......
Program will calculate the amount accumulated every month you save,
until you reach your goal.
Run Code Online (Sandbox Code Playgroud)
我不知道在一个字符串中放置break语句的位置,所以我可以正确地打印出来.