Friday, July 31, 2009

How can use class or structure and dynamic arrays for following problem and how to sort the aggregrate marks w

with their names as well ( not only the marks also with names in acsending order)?





there can be minimum of 1 student or maximum 40 students ina class.it is mandatory for all students to take 4 subjacts every semester namely mathematics, science,history and english for the final exam students can get marks between 0 and 100.


a c++ program to accept number of students in the cladss, all student's names and final exam marks foe each subject.Print the names of students,mark foreach subject,and aggregate in acsending order of the aggregrate marksfor the final exam.

How can use class or structure and dynamic arrays for following problem and how to sort the aggregrate marks w
If you have access to STL, you could use a multi-map to store the aggregate along with the names as the key and the rest as the value. Eventually, you would print out the results in the right format. You could use a comma separation between various values in both the key and the value.


You could also store the name with the marks in a class and create such objects to a vector. A sort function on this vector should give you the required result, provided you define your operator%26lt; appropriately.


No comments:

Post a Comment