Hey, My code after I execute it says that "accounts" has become corrupted...
What does this mean and how do I fix it?
#include <iostream>
#include <iomanip>
using namespace std;
class BankAccount
{
private:
int accountNum;
double accountBal;
const static double annualIntRate;
public:
void enterAccountData(int, double);
//void computeInterest();
//void displayAccount();
};
// implementation section:
//const double BankAccount::annualIntRate = 0.03;
void BankAccount::enterAccountData(int number, double balance)
{
cout << setprecision(2) << fixed;
accountNum = number;
accountBal = balance;
cout << "Enter the account number " << endl;
cin >> number;
while(number < 0 && number <= 999)
{
cout << "Account numbers cannot be negative or less than 1000 " <<
"Enter a new account number: " << endl;
cin >> number;
}
cout << "Enter the account balance " << endl;
cin >> balance;
while(balance < 0)
{
cout << "Account balances cannot be negative. " <<
"Enter a new account balance: " << endl;
cin >> balance;
}
return;
}
/*void BankAccount::computeInterest()
{
}*/
int main()
{
const int QUIT = 0;
const int MAX_ACCOUNTS = 10;
int counter;
int input;
int number = 0;
double balance = 0;
BankAccount accounts[MAX_ACCOUNTS];
//BankAccount display;
do
{
counter = 0;
accounts[MAX_ACCOUNTS].enterAccountData(number, balance);
cout << " Enter " << QUIT << " to stop, or press 1 to proceed.";
cin >> input;
counter++;
} while(input != QUIT && counter != 10);
system("pause");
return 0;
}