Inserting words into an array
I am trying to scan a list of words from a file. The list is as follows:
hello
this
is
a
list
Each subsequent word is on a new line. I'm trying to insert each word into an array, however, the code that I have only inserts the very first word - that's it.
Code:
void Array :: put()
{
Array a;
ifstream in("small.txt");
in >> a.buffer;
cout << a.buffer;
in.close();
}
So the ouput would only be: Hello
How can I modify this portion of my code to have it insert the entire list of words?