Need help on an array program!

Okay, so my assignment was to "write a program that will allow the user to enter 20 five letter words in an array and then place them into a word-find puzzle of the size 20 by 20. The words should be placed randomly in the puzzle in any of the directions possible. The program should use 2 two-dimensional arrays, one for the word placement and a second of Boolean type for word identification. Aso with the room left on the screen place a word list so the user knows what words they should be looking for."

So far, here is what I have:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//variable section
char Ans;
int R; //Rows
int C; //Columns
vector<string>Words(20);
apmatrix<char>Puzzle(20,20);
apmatrix<bool>Grid(20,20);





void main()
{
	do{

		for(

			for(R=0;R<20;R++) //Generate randomness
			{
				for (C=0;C<20;C++)
				{
					Puzzle[R][C]=char((rand()%26)+97);
					Grid[R][C]= false;
				}
	
}





		for(R=0;R<20;R++)  //Displaying
		{
			for(C=0;C<20;C++)
				cout<<Puzzle[R][C]<<' ';
				cout<<endl;

		}

		cout<<"Word list:"<<


		cout<<"Run program again (Y/N)?"<<endl;
		cin>>Ans;

	}while(Ans=='y'||Ans=='Y');

}//end main 


I still need help on how to ask the user for the words, how to display the word list at the end of the program, and basically how to put the program together. Thanks for your advice.
The problem description tells you that you need two 2-dimensional arrays. Protip: this is a lie, as it is FAR easier to do it with one 2D array ;)

As for how to ask the user for words, how about inputting five characters and then using cin.ignore(unsigned(-1)); to get rid of anything extra they typed?
Last edited on
Topic archived. No new replies allowed.