This is an incomplete code.. i need to create 2 account whose balance can be entered by the user and both accounts separately be accessed and altered. kindly help me with this. having difficulty in the marked parts.
#include <iostream>
class Account
{
public:
Account(int balance) : m_balance(balance)
{
// other stuff (but i wouldn't do all that checking you've done
// in a constructor).
}
private:
int m_balance;
};
int main()
{
Account account1(100);
Account account2(200);
// now you have 2 accounts.
return 0;
}
rather than just passing an amount on construction you could also pass in an account name. then ask the user for a name to search for. (which looks like what you might have to do).
if you do it like that you'll have to add your accounts to some kind of collection.