Description
-
Copy the function prototypes and two functions from instructions into your program. Comment out prototypes of functions not yet defined.
-
In main, set up your menu loop. See menu.cpp for a suggested pattern (but call the displayMenu function). Set up your switch to output a statement for each case for now.
-
If a wrong choice is entered, output: “Please enter 1, 2, 3, 4, or 5: “
-
Declare the Result struct
-
Define the displayDataset function (call displayHeader, etc.)
-
In main:
-
create an array of Result.
-
-
-
initialize it to the first three race results in the dataset (remove before step 10).
-
-
-
have a count variable, set to 3.
-
-
-
call displayDataset from cases 1 and 2 of the switch, make sure it displays properly.
-
(you could skip ahead to step 10 now if you prefer)
-
Define linearSearchByName
-
call it from case 3 of the switch
-
-
-
you will need to input the name from the user using getline(cin, variable). But you will need to do cin.ignore, or cin >> ws; before the getline.
-
-
Define sortByNumber
-
-
call it from case 1 of the switch
-
-
Define readDataset function:
-
-
copy dataset.txt to your directory.
-
-
-
in main:
-
-
create an ifstream variable for dataset.txt (include fstream) and open it in main!!
-
call readDataset from main before the display (set count to 0 first)
-
hint: temporarily output each result from readDataset to find any
problems
-
ctrl-C if infinite loop.
-
-
-
call it from case 2 of the switch
-
-
-
implement binarySearchByNumber
-
-
-
call it from case 4 of the switch
-
-