Vectors, Multidimensional Arrays

  1. 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 a typescript file with the record of at least one successful compilation of the fist project program below (the execution of the compiler on your source code file). Create a project titled Lab12_CollectionVectors. Implement the dynamically expanding and contracting collection functionality described in previous labs using vectors. In the main() function, you may declare the vector to hold numbers input. Specifically, your program has to support this dialog:

    Charlie, enter operation [a/r/q] and number: a 5.0
    your numbers: 5, sum: 5
    Charlie, enter operation [a/r/q] and number: a 8.0
    your numbers: 5 8, sum: 13
    Charlie, enter operation [a/r/q] and number: a 8.0
    duplicate!
    your numbers: 5 8, sum: 13
    Charlie, enter operation [a/r/q] and number: r 8.0
    your numbers: 5, sum: 5
    Charlie, enter operation [a/r/q] and number: r 10.0
    not present!
    your numbers: 5, sum: 5
    Charlie, enter operation [a/r/q] and number: a 3.3
    your numbers: 5 3.3, sum: 8.3
    Charlie, enter operation [a/r/q] and number: a 12.2
    your numbers: 5 3.3 12.2, sum: 20.5
    Charlie, enter operation [a/r/q] and number: q
    
    Hint: use iterators for number removal. Use find() algorithm to check if the number is present in the vector. Refer to this code for example usage.

  2. Multidimensional array. Create a project Lab12_MultArray. Implement a program that keeps track of the path that mouse takes in the maze.

    The mouse should start in the top-left corner and proceed under the direction of the user. The user inputs whether the mouse should move (l)eft, (r)ight, (u)p, (d)own or (q)uit. Assume that there are no inner walls. Your program does not have to check if the path crosses itself or if it goes outside the maze outer walls (assume that the user never takes the mouse outside the maze). Here is an example dialog:

    Enter direction (l)eft, (r)ight, (u)p, (d)own or (q)uit: d
      a b c d e f g
    1 * * *
    2     *
    3     *
    4 
    5         
    6
    7
    
    Enter direction (l)eft, (r)ight, (u)p, (d)own or (q)uit: r
      a b c d e f g
    1 * * *
    2     *
    3     * *
    4
    5
    6
    7
    ......
    
    You do not have to merge this program with the previously developed maze navigation program. You should store the path in the two-dimensional array of booleans. You should use the following code as a starting point. Refer to this program for multidimensional array example usage.

Milestone: Demonstrate program compilation in Unix and implement addition to the vector in the first assignment.

Make sure your programs adhere to proper programming style. Submit your projects to the subversion repository. Do not forget to verify your submission on the web.