First, I just want to mention that you shouldn't start a new thread when it is the same code. Just keep the original thread going to ask different questions about the same code.
I don't think you understood what I said about the return statement, read what I said again, and answer this - what does it do?
Some other ideas:
Why don't you have one struct for an account type that has everything in it - CustID, AccountNum, names, balance etc. Then have one array of structs. Have one function that sets everything for a customer. Have it loop so that it fills the array with all the customers.
You still have global variables which is bad. Did you read up about references?
Another concept is scope of variables. A variable only lasts until the closing brace, so the nCustomer on line 102, only lasts until line 116 - then it ceases to exist. So line 102 should be in main.
The printAccount function doesn't need to return anything, so make it void on line 99.
Your braces are a bit weird, lines 108 to 115 should look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
for (int customer = 0; customer < nCustomer; customer++) {
if (deposit >= 0 && accountNumber > 0) {
cout << endl << "**Account: ";
cout << newID << account << " **Balance: $";
cout.precision(2);
cout << fixed << deposit << endl;
}
}
return 0;
} //end of function
|
The brace I put in on line 2 isn't really necessary, but it might save you one day when you add more code to a for loop.
HTH