|
|
#include <vector>
and create a temporary string ( string temp;
). string words[20];
would become vector<string> words;
. You can then read into the temporary string, and use the vector function words.push_back ( temp );
to fill the vector. You can also change the for loop to while ( file >> temp )
.