assigning values from vector elements to a string

Hi big rookie here.
Im currently tasked with making a wordsearch solving program.
The user is to enter the grid of letters string by string.
The board is to be NxN so same number of columns and rows.
example:
DAB
DEB
TAB
So far my tactic has been to use for loops to assign a string all of the values
of individual vector elements by different order. then compare it to a dictionary file i loaded within my program, if it matches one of the elements within my dictionary vector it prints to the screen.
1
2
3
4
5
6
7
8
9
//example of my function to read top to bottom:
//height has been assigned the size() of my vector which has been vetted to be //equal to the length of individual elements within the vector.
for (size_t i = 0; i < height; i++){
string s;
   for (size_t j = 0; j < height; j++){
s.push_back(vec.at(j).at(i));
 if (s == dict) return true;
   }
}

this has actually worked for me and now i need to do harder ones like the main diagonals, left to right and even words backwards.
1
2
3
4
5
6
7
8
9
// this doesnt work
//to read backwards i have tried things like:
for (size_t i = 0; i < height; i++){
string s;
    for (size_t j = height - 1; j == 0; j--){
s.push_back(vec.at(i).at(j))
if (s == dict) return true;
    }
}

im not getting any compiler errors. just not working the way i want it to.
forgive any mistakes, first time posting.
and i appreciate any input someone can give.
On the main diagonal j=i. On any other diagonal j is a linear function of i. You can't assume j is changing independently of i like this.
Topic archived. No new replies allowed.