I have a pretty simple question. I have a program that prompts the user for how many people are desired for a simulation within the program. I am wondering how I would go about initializing the value of the cin objects. Here is a snippet of what I'm looking at:
cout<<"Number of users? ";
int users;
cin>>users;
The basics^. I want to take the input I get for users and make this many people objects. I have a class called CPerson that has several basic member functions like getName() and getGender(). I'm not so concerned with these. I then need to be able to put the number of users created into a queue which I figure won't be so hard once I have the objects initialized.
Thank you for any help.
UPDATE: I ended up with something that looked like this which yielded desired results. Thanks to all.
vector<CPerson*> people;
for (unsigned int x=0; x<users; x++) {
CPerson *user = new CPerson(Names[x]);
people.push_back(user);
cout<<user->getName()<<endl;
}
std::vector.vector<CPerson*> user; for (unsigned int x=0; x<numUsers; x++) { CPerson *people; people = user[x]; }