Question 1 #include using namespace std; int main() { int number[4][4] = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}, {12, 13, 14, 15}}; int row, col; while (1) { do { cout << "Row number = "; cin >> row; } while ((row < 0) || (row >=4)); do { cout << "Column number = "; cin >> col; } while ((col < 0) || (col >=4)); cout << "Content = " << number[row][col] << endl; } return 0; } Question 2 #include using namespace std; int main() { int t1[4][4], t2[4][4], t3[4][4]; int i, j; for(i=0;i<4;i++){ cout << "Enter the row "<> t1[i][j]; } for(i=0;i<4;i++){ cout << "Enter the row "<> t2[i][j]; } for(i=0;i<4;i++){ for(j=0;j<4;j++) t3[i][j]=t1[i][j]+t2[i][j]; } cout << "The sum of these two tables is"; for(i=0;i<4;i++){ for(j=0;j<4;j++) cout << t3[i][j]; cout << endl; } return 0; } Question 3 #include using namespace std; int main() { char c[4][4] = {{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}}; int i, j, choice, x, y, temp; while (1) { for (i=0; i<4; i++) { for (j=0; j<4; j++) cout << c[i][j]; cout << endl; } cout << endl; do { cout << "Row (1) or Col (2)? "; cin >> choice; } while ((choice != 1) && (choice != 2)); do { if (choice == 1) cout << "Enter the row numbers: "; else cout << "Enter the column numbers: "; cin >> x >> y; } while ((x < 0) || (x > 3) || (y < 0) || (y > 3)); cout << endl; if (choice == 1) for (j=0; j<4; j++) // swap row x and y { temp = c[x][j]; c[x][j] = c[y][j]; c[y][j] = temp; } else for (i=0; i<4; i++) // swap column x and y { temp = c[i][x]; c[i][x] = c[i][y]; c[i][y] = temp; } } return 0; } Question 4 #include using namespace std; int main() { int n, i, j, numbers[10][10]; do{ cout << "Input n: "; cin >> n; }while(n<1||n>10); for(i=0;i using namespace std; int main() { int n, i, j; char numbers[5][5]; do{ cout << "Input n: "; cin >> n; }while(n<1||n>5); for(i=0;i #include #include using namespace std; int main() { int s=6,i,j,r,c; char board[s][s]; int uncover = (s-2)*(s-2)-s; bool endgame = false; // initialise board for(i=0;i> r >> c; }while(r<1||r>4||c<1||c>4); // check & update board if(board[r][c]=='b') endgame = true; else{ uncover--; int count=0; for(i=r-1;i<=r+1;i++) for(j=c-1;j<=c+1;j++){ if(board[i][j]=='b') count++; } board[r][c]='0'+ count; } }while(!endgame&&uncover>0); if(uncover == 0) cout << endl << "You win! "<< endl; else{ cout << endl << "You lose! "<< endl; cout << " 1 2 3 4" << endl; for(i=1;i