Hi guys,
I have a class called Account with variables called Balance and Status. The Member Name is given by the User through cin and represents an the Account Number. How can I diynamically create an object through cin and give their variables a value through cin?
I have been looking for hours and just cannot figure it out. Any help is appreciated. Thanks guys.
Here's my code. It won't compile as I'm just trying to show what I want to do.
class Account {
public:
char Status;
int Balance;
};
int main() {
int Nmbr;
int Bal;
char Stat;
cin >> Nmbr;
cin >> Bal;
cin >> Stat;
Account Nmbr; // creates the object based on user input for 'Nmbr'
Nmbr.Status = Stat; // add the cin input 'Stat' to the variable Status to the newly created Account member
Nmbr.Balance = Bal; // add the cin input 'Bal' to the variable Balance to the newly creted Account member
cout << Nmbr.Number << endl; // display Account Status
cout << Nmbr.Balance << endl; //display Account Balance
}