so I'm thinking some kind of size of the array |
You need a counter of the number of names that have successfully been added to names and phones.
1 2
|
// After line 63
int cnt_names = 0;
|
You will have to add that ad an argument to each of your functions.
For add_name(), you will have to update the value. You can do that in one of two ways. 1) Pass cnt by reference. 2) Have addName return the updated values.
Line 29:
goto
s should be avoided.
Line 89: You should have a
default
case in the event the user doesn't enter a valid value.
line 29: sizeof(name) isn't going to work.
edit:
line 19: You should start your loop at num_names to avoid overwriting existing entries.
lines 68-90: You probably want to put these lines inside a loop so that a user can do multiple functions.
line 22: cin >> stops at whitespace. If you want the user to be able to enter names with embeded space, you want to use getline.
line 29: If the user enters "y", you're going to overwrite the entry the user just entered.
lines 34-35: You probably don't want these lines inside your loop. ALso, why not just use allContacts here?