So I'm writing some code and want to display the contents of a structure but after creating a pointer to put as the first element of the vector. When I have the program display the first element of the vector, it comes up blank. Any thoughts on what I'm doing wrong?
struct Account
{
string name;
double balance;
int acctNumber;
};
void create_Account(vector<Account> &accts);
int main()
{
vector<Account> accts(1);
create_Account(accts);
return 0;
}
void create_Account(vector<Account> &accts)
{
Account account;
cout << "Name: ";
cin >> account.name;
cout << "Balance: ";
cin >> account.balance;
cout << "Account No: ";
cin >> account.acctNumber;
accts.push_back(account);
cout << endl;
cout << "Name: " << accts[0].name << endl;
}