it shows like this:
Reading in:
Adam
Betty
Charles
Debbie
Elaine
Frank
George
Harry
Igor
Jerry
Karen
Larry
Reversed:
Larry
Karen
Jerry
Igor
Harry
George
Frank
Elaine
Debbie
Charles
Betty
Adam
but it needs to look like this
Reading in:
Adam
Betty
Charles
Debbie
Elaine
Frank
George
Harry
Igor
Jerry
Karen
Larry
Reversed:
Larry
Karen
Jerry
Igor
Harry
George
Frank
Elaine
Debbie
Charles
Betty
Adam
There are at least two problems here. First, too many getlines. Second, the reverse loop starts from an index position outside the array - very dangerous.
I assume you have an input file which contains exactly 12 names.
The first loop reads those names and stores them in the array. It also prints out the string just after it has been read.
Then the second loop (starting from index 12, which is the 13th element of the array - an out of bounds error) attempts to read a further 13 names from the input - this means you'd need to supply at least 25 names via the standard input.
I'd separate the reading from the displaying. Also, start the last loop from index 11, not 12:
hi Chervil! thank you very much :) now i know that getline can get me in trouble and i make a lot of sense. thank you very much for sharing your knowledge :) :)