For now: forget about the menu.
Your assignment is not about the menu, it is about measuring the time required for the program to calculate the fibonacci numbers. The menu is only helpful to start that process, but it is not relevant for your task.
If you have more options in your menu, you can test smaller parts of your program separately, so for the time being: keep the menu with as many options as you can.
In the end you will probably end up with something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
void mainMenu()
{
bool AGAIN = true;
size_t choosenNumber = 0;
do
{
showMenu();
char choice;
cout << endl << "Make your choice: ";
cin >> choice;
switch(choice)
{
case '1': choosenNumber = subMenu();
printStats( fibonacciTimer(choosenNumber) );
break;
case '2' :
case 'q' :
case 'Q' : AGAIN = false;
break;
default: break;
}
} while (AGAIN);
}
|
But for now that will only make it more difficult for you to implement the next step.
For the fibonacciTimer function I think you have to do a couple on things:
1. Measure time between the start of the function and the return of the fibonacciIteration
2. Create an Stats object and store the results in it
3. Store the Stats object in the tempVector.
4. Do the same (1, 2 and 3) for the fibonacciRecursion function
5. Repeat step 1 to 4 for the nthNumber times
Think of these as 5 separate problems. I would start solving the first one:
- Write a function that writes the time it took to execute the fibonacciIteration function to cout.