void PrintWordsInRow(const apmatrix & crossWord, int r) // precondition: crossWord contains only uppercase letters or spaces // 0 <= r < crossWord.numrows() // postcondition: prints the words in row with index r of crossWord, // one word per line { int k; int cols = crossWord.numcols(); k = 1; // avoid boundary while(k < cols-1) { // check if at least two non-space characters in a row if (crossWord[r][k] != ' ' && crossWord[r][k+1] != ' ') { // loop is safe because boundary is spaces while (crossWord[r][k] != ' ') { cout << crossWord[r][k]; k++; } cout << endl; } k++; // this is safe (loop exits on space) } }