Line 18,22,26,30,34,38,42: C++ does not support implied left hand side in conditionals. You must fully specify the conditions.
Example:
if (ans == 'Y' || 'y')
evaluates as
if ((ans == 'Y') || ('y'))
('y')
always evaluates to 1 (
true
), therefore the if statement is always true.
Lines 20,24,28,32,36: These are function declarations, not function calls. Remove the
void
,
string
and
const int
.
Line 53: This will cause an out of bounds reference. You're inputting to list[20] on every iteration. You want:
Line 67: I think you want the
flag = 1;
within the if statement.
Line 62,67,70: As a matter of style, you should use
true
and
false
rather than 0 and 1 when using a
bool
.
Line 75: This is going to cause a bounds errors. This is going to
cout << list[20]
which doesn't exist. Did you intend to output each of the names in the arrray?
Line 118: This is going to cause the function to exit on the first iteration.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.