Hi everyone, big time c++ newbie here, in fact I don't know too much at all about what I'm doing. But what I am trying to do at this point is read into a file created by my program, check and see if a name to be inputed is exists or not, and if not it is to be added to the list.
Here's what I've come up with so far...
vector<string> Names;
ofstream ScoreFile;
do
{
string PlayerName = GetLine( "Enter your name -->" );
ScoreFile.open( "Scores.txt" );
for ( vector<string>::size_type Index = 0
; Index < PlayerName.size()
; ++Index )
if ( PlayerName == Names[Index] )
ScoreFile << PlayerName;
if ( ScoreFile ) break;
ScoreFile.clear();
cout << "File didn't open." << endl;
} while (true);
It does compile, but when I type in a name all hell breaks loose and it says vector subscript is out of range.