Multidimensional Arrays/Vectors of Vectors

This lab is to be done using Unix. To familiarize yourself with Unix, read this tutorial.

To prove that you used Unix tools, as part of your project submission, you need to submit typescript file with the record of at least one successful compilation of one of the programs below (the execution of the compiler on your source code file).

  1. Multidimensional arrays. Create a project Lab13_MultArrays. Implement a program that keeps track of shots fired in a battleship game. Your program should ask the user if she wants to take another shot, ask for shot coordinates and then print the locations of all shots fired so far in a grid. Here is an example dialog:
    Another shot? [y/n] y
    Location?  a 1
    All fired shots
      a b c d e
    1 *       *
    2     *
    3
    4 * *   
    5         *
    Another shot? [y/n] y
    ...
    
    You should store the shots in a two-dimensional array of booleans. You should use the following template.

    Refer to this program for multidimensional array example usage.

  2. Vectors of vectors. Create a project Lab13_VectVectors. Modify the above program functionality to operate on the ocean of arbitrary size. Before starting the recording of the shots, the program should ask the user for the length and width of the ocean. For printing, you do not have to handle the situation when the ocean size width is larger than 26. That is, you can assume that the number of lower case letters is always greater than the width of the ocean.

    Implement the program using a vector of vectors. Use the following template.

    Refer to this program for example usage of vector of vectors.

    Hint. C++ allows character arithmetic. It is assumed characters for digits, lower case letters and upper case letters are in order. Arithmetic operations such as adding a number to a character variable or incrementing a character variable are allowed. See this example for illustration. You can use this property to print letters in the grid of your shots printout.

Make sure your program adheres to proper programming style. Do not forget to verify your submission on the web.