I'm trying to create a function that uses dynamic allocated arrays instead of vectors because I want to see how they work. Basically, this function asks the user to input how many people they are going to enter followed by their name; then, they enter how many of these people want to register for an ID followed by their phone #.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
"How many customers will you like to enter? " 3 //user inputs 3
Bob Allen //user input
Ellen Michaels //user input
Jane Andrews //user input
"How many people want to register for the VIP ID? " 4 //user inputs 4; user can enter a new name here if they forgot to enter it the first time
Jane Andrews 213-2312
Bob Allen 111-1212
Jonathan Drew 211-9283
Michael Jacks 912-3911
//what the program spits out after the function is implemented
Final Registration: Guaranteed VIP IDs
Bob Allen 111-1212
Ellen Michaels NOT GUARANTEED
Jane Andrews 213-2312
//The new users entered in the 2nd round will not be listed in the final registration because it is too late for them to sign up
Basically, the problem I'm having is:
1 2 3
1. How to check if the person is not listed in the second round
2. Ignore the new people the user entered in the second round
3. Print the final registration in the same order the user entered the names in the first round
This is what I have right now, but this only works if the same number of users is entered the first and second time around. It does not check if there are new or omitted
string* people;
cout << "How many customers will you like to enter? " << endl;
int howmany;
cin >> howmany;
people = newint[howmany];
for (int i=0;i<howmany;i++)
{
cin >> people[i];
}
cout << "How many people want to register for the VIP ID? " << endl;
int num_of_register;
string* vip;
cin >> num_of_register;
vip = newint[num_of_register];
for (int i=0;i<num_of_register)
{
cin >> vip[i];
for (int j=0;j<howmany;j++)
{
if (num_of_register == howmany) {
if people[j] == vip[i] //check if they're the same people or not
cout << "Final Registration: Guaranteed VIP Ids" << endl;
cout << people[i];
else {
//check if the names are the same
}
}
}
Any guide/advice will be helpful. I'm not sure how to approach this problem. Thank you!