This is what I have to look for the word & is repeated exactly the same for other directions (N,S,etc) inside the for loop (i didnt include it bc of length) except I have rowBlock and colBlock +run or -run:
for (int rowBlock = 0; rowBlock < 18; rowBlock++) {
for (int colBlock = 0; colBlock < 18; colBlock++) {
if (string(1, namesToSearch[i][0]) == (wordSearchBlock[rowBlock][colBlock])) {
PsblRow = rowBlock;
PsblCol = colBlock;
//checking in the NW direction
for (int run = 1; run <= namesToSearch[i].length(); run++) {
if (string(1, namesToSearch[i][1]) == (wordSearchBlock[rowBlock - run][colBlock - run]) && (rowBlock - run) >= 0 && (colBlock - run) >= 0) {
direction = "NW";
if (run = namesToSearch[i].length()) {
cout << movieName << " found at " << PsblRow << ", " << PsblCol << ": (direction = " << direction << ")" << endl;
wordExists++;
}
}
else {
break;
}
}
}
}
To give some context: namesToSearch is a vector of strings & wordSearchBlock is an array[18][18] PLEASE HELP ME!! I dont know whats wrong this is an example of the output I keep getting:
ALL OF ME found at 2, 9: (direction = NE)
ALL OF ME found at 2, 17: (direction = N)
ALL OF ME found at 2, 17: (direction = N)
ALL OF ME found at 2, 17: (direction = SE)
ALL OF ME found at 5, 3: (direction = SE)
ALL OF ME found at 5, 3: (direction = SE)
ALL OF ME found at 5, 6: (direction = S)
ALL OF ME found at 5, 6: (direction = S)
ALL OF ME found at 5, 12: (direction = W)
ALL OF ME found at 5, 12: (direction = W)
ALL OF ME found at 5, 12: (direction = SE)
ALL OF ME found at 5, 12: (direction = SE)
ALL OF ME found at 6, 0: (direction = N)
ALL OF ME found at 6, 0: (direction = N)
ALL OF ME found at 6, 0: (direction = SE)
ALL OF ME found at 7, 7: (direction = NW)
ALL OF ME found at 7, 7: (direction = W)
ALL OF ME found at 7, 7: (direction = W)
ALL OF ME found at 8, 0: (direction = NE)
ALL OF ME found at 8, 4: (direction = NE)
ALL OF ME found at 8, 4: (direction = NE)
ALL OF ME found at 8, 4: (direction = E)
ALL OF ME found at 8, 17: (direction = SE)
ALL OF ME found at 9, 9: (direction = SW)
ALL OF ME found at 9, 9: (direction = S)
ALL OF ME found at 10, 14: (direction = NE)
ALL OF ME found at 10, 17: (direction = NE)
ALL OF ME found at 10, 17: (direction = W)
ALL OF ME found at 11, 11: (direction = W)
ALL OF ME found at 11, 11: (direction = E)
ALL OF ME found at 11, 11: (direction = SW)
ALL OF ME found at 11, 15: (direction = NE)
ALL OF ME found at 11, 16: (direction = N)
ALL OF ME found at 12, 11: (direction = NW)
ALL OF ME found at 12, 11: (direction = NE)
ALL OF ME found at 12, 11: (direction = W)
ALL OF ME found at 12, 13: (direction = NW)
ALL OF ME found at 13, 17: (direction = NE)
ALL OF ME found at 15, 14: (direction = S)
ALL OF ME found at 15, 15: (direction = SW)
ALL OF ME found at 15, 15: (direction = SW)
And the real location is at 8,4.