int之前应为不合格id

expected unqualified-id before int

本文关键字:不合格 id int      更新时间:2023-10-16

当我试图编译它时,我在c++中得到了这个错误"在int之前应该是不合格的id"。

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");
}

我试图找出哪里出了问题,但没能找到。

提示:

void yearlyWithdrawal(int startingAge, int numOfYears), int yearlyAmount, double interestRate)
// --------------------------------------------------^
void yearlyWithdrawal(int startingAge, int numOfYears), int yearlyAmount, double interestRate)

此行中间的)可能是an int'之前的问题的明显指针。