I'm trying to read a text file containing 20 names into an array of strings, and then print each string to the screen.
string monsters[20];
ifstream inData;
inData.open("names.txt");
for (int i=0;i<monsters->size();i++){
inData >> monsters[i];
cout << monsters[i] << endl;
}inData.close();
However when I run this code the loop is executed but nothing is read into the array. Where have I gone wrong?