No idea how to start a program, how can I read a file entry into an array?

I have no idea how to start this somewhat difficult Hangman program. This is how I'm supposed to do the program:

"Create a program to allow a user to play a game of Hangman (You may simulate the drawing of some other object or just keep track of how many wrong guesses were made). You must use an external data file that will contain at least 20 phrases or words, read all of the entries into a list or array and randomly select which word or phrase is displayed as blank spaces or stars on the screen.
Create functions and prototypes to modularize your program. Use appropriate string functions to find the position of characters within your phrases or words. Utilize the indexing feature of strings to identify specific locations and what characters they contain."

What I don't know what to do is make a external text file be placed into array, and how to find the position of characters of the words in the text file. And generally, I don't have a clue on how to start coding the program. I have the text file with words, so do I make the program read the text file in the main function? Or do that in another separate function?

This is all what I have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

const int LIVES=//ANYTHING, this const will count how many lives the player has
//function that displays how many lives player has (hanged man)?
//function to tell wether player won or lost?

int main ()	//main function reads file
{
	int ARRAY_SIZE = 20; //20 words, 20 variables?
	ifsteam inputFile;	
	string WORD;	//string is word from txt file
	inputFile.open("HangmanWordList.txt");
	//how to read file into an array?	

}
Here is the link you can find a way to solve the problem

http://programminglearners0349.blogspot.com/2015/05/read-file-to-array-c.html
Topic archived. No new replies allowed.