# 13.14. Coding Practice¶

Create the enumerated type Planet, which maps the planets in our solar system to integers starting at 1. Make sure to list the planets out in order! (Sadly, Pluto is not a planet :( )

Below is one way to implement the program. The planets in our solar system are Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.

Selecting from: cp_13_AC_2q, cp_13_AC_2_pp

A Bingo board has 25 Spaces in a matrix-like grid. A Space has a number value randomly selected from 1 to 75 and can either be filled or not. Write the struct definitions for Space and BingoBoard.

Below is one way to implement the program. We declare the Space and BingoBoard struct and create the instance variables in order. Make sure to set is_filled to false!

Selecting from: cp_13_AC_4q, cp_13_AC_4_pp

Now we need a way to swap the values at two indices in a vector. Write the function swapValues, which takes a vector of ints and two indices as parameters.

Below is one way to implement the program. We store the value at index1 in a temp variable, replace the value at index1 with the value at index2, and then finally replace the value at index2 with the value of temp. Make sure to pass vec by reference!

Selecting from: cp_13_AC_6q, cp_13_AC_6_pp

We can now fill our BingoBoard with values! Write the BingoBoard member function makeBoard. Use the generateRandVec function and select the first 25 values to fill up the board. Make sure to create a free space in the middle of the board! Set the value of the free space to 0 and is_filled to true. All other spaces should have is_filled set to false.

Below is one way to implement the program. First we need to initialize the board to the correct dimensions. Then, we use generateRandVec to create a vector of random values from 1 to 75. Afterwards, we set the values of the 25 Spaces to the first 25 values in the random vector. Lastly, we set the middle Space to 0 and set its is_filled to true.