【发布时间】:2018-10-17 07:28:42
【问题描述】:
所以我一直在我的计算机科学课上处理命令行参数,我得到了这个:
错误:'{' token { { ^
我一直在试图弄清楚它有什么问题,但在我的第一个 int 语句之后出现错误,我无法理解?这是代码。任何指导将不胜感激!在编码方面,我几乎是个菜鸟。
#include <iostream>
#include <string>
#include <sstream> // for std::stringstream
#include <cstdlib> // for exit()
using namespace std;
double int_rate;
const double RULE72 = 72;
const double YDAYS = 365;
int main(int argc, char *argv[]);
{
printf("argc = %d", argc);
double amount;
double int_rate;
int days;
int years;
cout << "What is the interest rate? ";
cin >> int_rate;
years = RULE72 / int_rate;
cout << "Your money doubles in " << years << " years.";
days = years * YDAYS;
cout << "Your money doubles in " << days << " days." << endl;
cout << "Amount you would like to see double. ";
cin << amount;
cout << "Money earned by day " << (amount * 2) / days << endl;
return 0;
}
【问题讨论】:
-
尾随
;int main(int argc, char *argv[]);- 删除它
标签: c++ command arguments line