Programming
programming again cpp same

Question Description

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

    ------------------------------------------------------------------------------------------------

    Final Answer

    Here's your program.
    Great working with yo...

    criss53 (2975)
    Boston College

    Anonymous
    I was on a very tight deadline but thanks to Studypool I was able to deliver my assignment on time.

    Anonymous
    The tutor was pretty knowledgeable, efficient and polite. Great service!

    Anonymous
    I did not know how to approach this question, Studypool helped me a lot.

    Studypool
    4.7
    Trustpilot
    4.5
    Sitejabber
    4.4

    Brown University





    1271 Tutors

    California Institute of Technology




    2131 Tutors

    Carnegie Mellon University




    982 Tutors

    Columbia University





    1256 Tutors

    Dartmouth University





    2113 Tutors

    Emory University





    2279 Tutors

    Harvard University





    599 Tutors

    Massachusetts Institute of Technology



    2319 Tutors

    New York University





    1645 Tutors

    Notre Dam University





    1911 Tutors

    Oklahoma University





    2122 Tutors

    Pennsylvania State University





    932 Tutors

    Princeton University





    1211 Tutors

    Stanford University





    983 Tutors

    University of California





    1282 Tutors

    Oxford University





    123 Tutors

    Yale University





    2325 Tutors