was in this for few hours now and I cannot seem to find the right way to do this. I am creating a vector that will be populated with structs but I could not make it to work. I have tried making a struct and put the struct from the object in there but received an error. Anyways this is my work, I am really new into this so I hope you guys could help me out.
main.cpp
#include <iostream>
#include "CBank.h"
int main()
{
CBank bank;
struct account = bank.account;
bank.account.name = "Alpha Omega";
bank.account.money = 15635.23;
bank.account.pin = 3241;
bank.add.push_back(account);
return 0;
}
CBank.h
#ifndef CBANK_H
#define CBANK_H
#include <iostream>
#include <vector>
class CBank
{
public:
CBank();
private:
struct account { std::string name;
float money;
short pin;
};
std::vector<account> add;
};
#endif // CBANK_H
CBank.cpp
#include "CBank.h"
CBank::CBank()
{
//ctor
}