Hi,
Can you not just append a number to the name by using
std::string
+
operator like you have elsewhere in the code? Put all the user names into a std::vector.
Some other things I noticed, just to help you out for some good guidelines & style:
} while (choice != 1 && choice != 2 && choice != 3);
I really
dislike no hate constructs like that :+) You already have a
switch
instead. Make the
exit
option set a
bool
Quit
variable to true, make that the end condition for a
while
loop.
With this:
88 89 90 91 92 93 94 95 96 97
|
do
{
cout << endl;
cout << "Is This Information Correct? Please ENTER (Y for Yes or N for No): ";
getline(cin, check);
} while ((check != yes) && (check != yes2) && (check != no) && (check != no2));
cout << endl;
} while ((check != yes) && (check != yes2));
| |
You can avoid this nightmare :+) by making use of the
toupper
function to halve the logic, Just check for Y or N
What is the fascination beginners seem to have with
do
loops :+) ? Did you know that all three looping constructs can be converted from one to another? I use a
for
loop when I know how times to loop, and a
while
loop otherwise.
You could do with some more functions. There is a guideline which says that functions should be no longer than 40 LOC, some go for even less. This will improve the readability and aid understanding of the code
Proper indentation would make the code easier to read.
Good Luck !!