The last line is matching, but because it thinks the array size is zero it drops out and states that it doesn't match.
Haven't looked at any of the logic except this:
while(inFile) // the file stream is not yet at eof after the last line has been read
{
inFile.getline(inputArray, 8,'\n'); // try to read one past the last line
// getline fails; and the stream goes an eof state
// but we proceed as if no error has occurred.
// ...
The correct idiom to read every line in a stream checks for failure after (not before) attempted input:
while( inFile.getline(inputArray, 8,'\n') ) // if we have read a line
{
// go ahead and do something with the line
// ...
static const ET CAPACITY = 20; //Size of the array
What happens if you encounter a line that is longer than this?
Is there a compelling reasaon not to use std::string
?
Use the standard library - people who say you don't 'learn' C++ by if you use the language library are people who haven't learned C++ yet.
Ignore them for your own good.