当我尝试编译它时,我在c ++中遇到了这个错误“期望unqualified-id in int”。
void yearlyWithdrawal(int startingAge, int numOfYears), int yearlyAmount, double interestRate)
{
int age = startingAge;
int lastAge = startingAge + numOfYears;
double cash = yearlyAmount;
cout << "Age | Yearly Plan" << endl;
cout << "----+----------------" << endl;
while (age <= lastAge)
{
cout.width(3);
cout << age << " | ";
cout.width(15);
cout.precision(2);
cout.setf(ios::fixed);
cout << cash << endl;
if (age != lastAge)
cash = cash + cash*interestRate / 100.0;
age++;
}
system("pause");
}
我试图找出问题所在但却无法解决。
答案 0 :(得分:8)
提示:
void yearlyWithdrawal(int startingAge, int numOfYears), int yearlyAmount, double interestRate)
// --------------------------------------------------^
答案 1 :(得分:5)
void yearlyWithdrawal(int startingAge, int numOfYears), int yearlyAmount, double interestRate)
在'int'之前,此行中间的)
可能是指向问题的明显指针。