简体   繁体   中英

Which data structure would be best for an expandable user database

I am attempting to create a data structure that will hold an unknown number of users and will be expanding as the program goes on. I'm using a struct that will have multiple instances of it places into the structure and now I'm wondering which structure should I use for an expanding user base that would need random checks and access.

The struct I'm using:

    struct Bank{
      string userName;
      string password;
      string legalName;
      int accountNum;
      string accountType;
      map<string, int> accountBal;
      list<string> recPayments;
      map<string, int> CardNums;
      map<string, list<string>> transactions;
    };

Thanks

When I see a structure that walks like a database and swims like a database and quacks like a database, I call that structure a database.

In essence your trying to make a relational database.

struct Account {
  string userName;
  string password;
  string legalName;
  int accountNum;
  string accountType;
};

And the following relational tables.

  map<string, int> accountBal;
  list<string> recPayments;
  map<string, int> CardNums;
  map<string, list<string>> transactions;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM