What about adding a class. Starting with that is a great way to group data together.
class UserInfo
{
private:
std::string Name;
std::string Pass; // THIS IS NOT SECURE
int age;
// etc...
};
But you may want to just use a token index e.g.
class UserDetails
{
std::string Name;
int index;
}
and then use the index number (e.g. your
i as a way of looking up a data-entry elsewhere.
This way you can either do something like this:
UserDetails* UPtr= findUser(Name);
if (UPtr)
UPtr->printUser();
// or:
DataBaseObj DB;
// stuff...
if (UPtr)
DB->printUser(UPtr->getIndex());
Note: You could sort your list of users and then when you have lots you don't need to loop through all of them.
Also: your current code prints a lot of "your pass was not regonised"
That needs to be after the loop if you don't find a user. So have another look at your if/else construction.
Think about using
std::map<std::string,userClass> or
std::vector<userClass> or something else other than a simple array. Since you will want to add new users later.
Don't
use using namespace std; it simple defeats the objective of namespace std: to NOT pollute your global namespace.