This is not a noob question at all but an interesting one. Yeah, you take input from a text file and save it into an array.
I am trying to shed some light on this but let me show you the sample code first:
using namespace std;
int main ()
ifstream myfile ("Test.txt");
while (! myfile.eof() )
array[loop] = line;
cout << array[loop] << endl;
else cout << "can't open the text file";
Well, here it is. Now, let's try to decode our program. The three header files are used for the following:
input-output stream, input, and output operations and use to create files, and saving the line into the array.
Dive into the main function, we created a string array to hold the names inside the array and the string line will store the data from the text file up to two values using the for-loop.
I hope, this little explanation will help you to get the program well.