You're misusing your vector. An object in a vector (account) shouldn't be self-referential to the vector (accountList).
Line 5: Avoid the use of
namespace std
.
Line 7: You should have at least two classes. Account and ATM. They represent different things. You are conflating them. An account represents a customer. An ATM is a physical device that dispenses cash from a specific account and accepts deposits to a specific account. i.e. A specific account should be passed to an ATM function as a reference parameter.
Your class declaration(s) and class function definitions should be in separate files (.h and .cpp).
I see no main function. All C++ programs must have a main() function.
Line 54-62: This function is flawed. An instance of an ATM should not reference a global (AccountList). You can't refer to AccountSize-1. What happens when AccountSize is zero? Illegal (out of bounds) reference. Use push_back(obj) to add an object to a vector.
Line 107: What happens if the withdrawalAmount is greater than the balance?
Line 147: Why are you passing accountId to GetUsername()? You don't use it.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.