programming again cpp same 1

Objective: Learn how to define structures, create and access a vector of structures

    Assignment:

    Modify your lab1 to read a file containing a list of students’ names followed by their test scores. Define a structure to store name and score. Instead of just a vector of scores, you will now need a vector of structures. Each element in the vector will have the student’s name and the average of his or her score. Your program needs to be able to sort the vector by both name and score, so you need to implement two different compare functions to pass to sort:

    sort (students.begin(), students.end(), compareByName);

    sort (students.begin(), students.end(), compareByScore);

    sort will use the function that you provide to sort the data.

    This is how function compareByName should look like:

    bool compareByName(Student stu1, Student stu2) { return stu1.name < stu2.name) }

    Display the scores sorted by name and score, the class average and median. No matter how the data is sorted, you should print both name and score. For example, students sorted by name:

    ————————————————————————————————

    Ana 73

    Daniel 66

    ————————————————————————————————-

    Students sorted by score:

    ————————————————————————————————

    Daniel 66

    Ana 73

    ————————————————————————————————

     
    Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
    Use Discount Code "Newclient" for a 15% Discount!

    NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.