# Mixed Up Code Practice¶

Below is the enumerated type Days which maps days of the week to integers starting at 1. Use a switch statement to determine whether or not day is a weekend or not. Check for cases in numerical order.

Use a switch statement to check and print out whether a number is divisible by two. Prompt and get input from the user. If input isn’t valid, print out the default statement “Invalid input.” Check for cases in numerical order.

Use a switch statement to check and print out the maximum between two numbers. Prompt and get input from the user for two integers. If input isn’t valid, print out the default statement “Invalid input.” Check for cases in numerical order.

Below is the pseudocode for the implementation of mergeSort. Put the blocks in the correct order!

Let’s revisit the Dictionary data structure defined in the previous section. Write the struct definitions for Entry, which has member variables word and page, and for Dictionary, which has a vector of Entries. Put the necessary blocks of code in the correct order.

Assume our dictionary is currently unsorted. Let’s write a Dictionary member function find that takes a string word as a parameter and returns the index of its corresponding entry. If the word isn’t in the dictionary, return -1. Put the necessary blocks of code in the correct order.

Of course, all dictionaries are in some sort of order. In order to do this, we must first write the Dictionary member function findFirstWord, which takes a starting index as a parameter returns the index of the Entry with the highest priority alphabetically (i.e. the Entry with a word that would come first in the alphabet). Put the necessary blocks of code in the correct order.

We also need a swap function. Write the Dictionary member function swap which takes two indices as parameters and swaps the Entries at those indices. Put the necessary blocks of code in the correct order.

Now let’s write the Dictionary member function alphabetize, which sorts the Entries in the Dictionary in alphabetical order. Use the findFirstWord and swap functions we defined earlier! Put the necessary blocks of code in the correct order.

Let’s check to see if our sorting worked! Write the Dictionary member function printDictionary, which prints out the word in each Entry. Put the necessary blocks of code in the correct order.