Starting from:
$25

$19

Suggested steps for implementing PA#2


    1. Copy the function prototypes and two functions from instructions into your program. Comment out prototypes of functions not yet defined.
    2. 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.

    3. If a wrong choice is entered, output: "Please enter 1, 2, 3, 4, or 5: “
    4. Declare the Result struct
    5. Define the displayDataset function (call displayHeader, etc.)

    6. 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)
    8. 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.

    9. Define sortByNumber

        ◦ call it from case 1 of the switch

    10. Define readDataset function:

        ◦ copy dataset.txt to your directory.

        ◦ in main:

    o create an ifstream variable for dataset.txt (include fstream) and open it in main!!

    o call readDataset from main before the display (set count to 0 first)

    o hint: temporarily output each result from readDataset to find any
problems
    o ctrl-C if infinite loop.
        11. implement sortByDistanceTime

            ▪ call it from case 2 of the switch

    12. implement binarySearchByNumber

            ▪ call it from case 4 of the switch

More products