We're supposed to create a Bank Account class, with a few public functions, and a main function. The main function is supposed to use an array (professor said 2 for his own sake) and pass the array, a count of valid items in the array, and an integer (used for years) b/t 1 & 40 inclusive to a function that will calculate and display the value of each account in the array after the given years.
My problem is that last function, which I'll post here:
1 2 3 4 5 6 7 8 9 10 11 12
|
void interestTable(BankAccount[] array1, int acct, int time)
{
for (int x=0; x<acct; x++)
{
double finalValue=array1[x]::balance;
for (int y=0; y<time; y++)
{
finalValue=finalValue*array1[x]::annualRate;
}
cout<< "In " time "years, account # " array1[x]::acctNum "will have $" finalValue ".";
}
}
|
I have the function listed in the class's pubic section as such:
void interestTable(BankAccount[], int, int);
I receive the following errors when attempting to compile, which mystify me as this is my first program in c++.
1>f:\project1_bankaccount_ch7.cpp(88): error C3861: 'interestTable': identifier not found
1>f:\project1_bankaccount_ch7.cpp(97): error C2146: syntax error : missing ')' before identifier 'array1'
1>f:\project1_bankaccount_ch7.cpp(97): error C3646: 'array1' : unknown override specifier
1>f:\project1_bankaccount_ch7.cpp(97): error C2062: type 'int' unexpected
1>f:\project1_bankaccount_ch7.cpp(97): error C2059: syntax error : ')'
1>f:\project1_bankaccount_ch7.cpp(98): error C2143: syntax error : missing ';' before '{'
1>f:\project1_bankaccount_ch7.cpp(98): error C2447: '{' : missing function header (old-style formal list?)
any help on shortening this list of errors would be most appreciated, as I've seen that fixing one error sometimes takes several off the list.