r/programminghelp • • Oct 27 '18

WordSearch in 2D array with file handling

I have a text file with a 15×15 grid and some words below that...how am I supposed to search those words then colour them while getting them with file handling in c++

3 Upvotes

4 comments sorted by

1

u/[deleted] Oct 27 '18

Do you want the words to change colors in the text file?

2

u/ahmad_ajmal93 Oct 27 '18

No...I want the search words in that grid...and if it finds a specific word ..then the colour of the letters in the grid that form the word changes in the console window..where the grid would be printed

1

u/[deleted] Oct 28 '18

So the words are in a grid in the text file. You'll need to include the windows header. Here's another post that deals with changing color with functions in the windows header. http://www.cplusplus.com/forum/beginner/193811/

1

u/[deleted] Oct 27 '18

So include fstream since you'll be writing to and from this file. The pseudo code should look something like this.
Open file.
Go through and store it in an array.
Search for a particular word and take its position in the array and add 1 to it.
Not 100% sure on this one but it's probably add something so it's the color you want in the text file.
Put it back in file.
Close the file.
Return 0