Question #37847

Sort command to display all the student records in sorted order either by name or by GPA
(the
so
rting criteria is case insensitive)
o
For example: sort:name

Search command to find a studen

Expert's answer

Answer on Question#37847- Programming, C++

1. Sort command to display all the student records in sorted order either by name or by GPA (the sorting criteria is case insensitive)

For example: sort:name

2. Search command to find a student

Solution.

1)


using System.Collections;
SortedList sort;
sort.Add(Name, GPA);
for (int i = 0; i < sort.Count; i++)
{
    Console.WriteLine(sort.GetKey(i).ToString());
}


Use this design, now the data is sorted by key Name. If you want to sort by value GPA, you need to put in place the values of GPA Name to place the key.

2)


// Can also search by key:
Console.WriteLine(sort[StudentName].ToString());

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS