All the students in a class are involved in any one of the Sports, be it indoor or outdoor. The details of their Names, Roll_no, Sport are recorded as a list. Write pseudocodes to return the following.
a. Given a Roll_no, return the Sport(s) he/ she has registered.
b. Given a Sport, find the list of students who have enrolled for the same
a)
A linked list can be used to store the details of the students.
Declare one stucture containing Names, Roll_no and Sport as data members.
Declare a function outside the structure to add student's details to the structure.
Use a function that accepts the student's Roll_no and returns sport the student is participating in.
b)
Create a function that accepts Sport as a parameter and return the list of students participating in that sport.
Traverse the whole linked list and display all the students participating in the sport provided.
Comments
Leave a comment