#include #include #include using namespace std; int main () { char grid[14][14] = {0}; int count[14][14] = {0}; int row; int col; int limit; string word; char direction; int howMany; int number; int pos; int let; ifstream in; string filename; cout << "What is the file name? "; cin >> filename; in.open(filename.c_str()); in >> howMany; for (number = 0; number < howMany; number++) { in >> row >> col >> direction >> word; if (direction == 'a') { limit = col + word.size(); let = 0; for (pos = col; pos < limit; pos++) { grid[row][pos] = word[let]; count[row][pos]++; let++; } } else { limit = row + word.size(); let = 0; for (pos = row; pos < limit; pos++) { grid[pos][col] = word[let]; count[pos][col]++; let++; } } } cout << endl << endl << "The message is: "; for (row = 1; row < 13; row++) for (col = 1; col < 13; col++) if (count[row][col] == 2) cout << grid[row][col]; cout << endl; return 0; }