All right, congratulations for making it through this section.
We covered a lot of material in this section.
Hopefully, you have a pretty good grasp of c++
functions and how they work.
Now you're ready for a challenge.
This challenge won't be easy.
Remember the challenge from section 9.
In that challenge, we had a vector of integers and we wrote a menu-driven
system that allowed the user to display the numbers, add a number
to the list, calculate the mean, the smallest and the largest.
That challenge was all about applying what you learned up to
that point in the course, and let you use control flow statements
like loops and if statements.
Well, for this challenge, we're going to solve that problem all over again.
Except this time our solution will be modularized in terms of functions.
You can start with your solution and refactor it so that it uses functions.
Or you can start with my solution which is included in the
challenge project in workspace 11.
Or you could start this challenge from scratch, it's really up to you.
Let me give you a few hints and tips for this challenge.
Remember, this is not an easy challenge, so if you get frustrated
take a break, come back to it later.
Here are a few hints.
Create functions for each of the major functions in the program.
Keep the function small.
Remember the boss worker analogy.
Keep the vector declaration in the main function and
pass the vector object to any function that requires it.
Don't be tempted to move that vector object outside the main
and make it a global variable that will really defeat the
whole purpose of this exercise.
Now you can start by defining a function that displays the menu,
that's a real simple function call it display menu, and all it is
is a bunch of output statements.
And then you can call that function whenever you need to display the menu.
You can then define a function that reads the selection from the
user and returns it in uppercase.
That way we don't have to deal with checking lowercase
and uppercase selections.
Then create functions for each menu option.
And then finally, create functions that display the list of numbers,
function that calculates the mean a, function that looks for the
smallest and the largest and so forth.
Take it one function at a time, and take your time.
Again, if you get frustrated, take a break.
Finally, don't forget to use function prototypes.
Use them, let the compiler help you every step of the way.
All right, good luck.
I know you can do it.
When you're finished, compare it to my solution, which is in the next video.