Displaying marks

I am programming a code that will allow users to select four choices from a menu.
These choices are exit, statistics, enter mark, and find mark.
For one of my assignment questions it states:
"When Find mark is selected, the user will enter a student ID and the program will then locate the mark corresponding to the given ID and display the record". The record consists displaying the student ID, the corresponding mark, and the grade.

I was wondering what is the best approach to program this?
I am currently using a linear search. Is this the easiest approach or are there better/easier alternatives?
closed account (S6k9GNh0)
I would make a struct containing the data, an identifier (possibly number or something else) and possibly other corresponding data. Or you could simply create a map while the name of each array element is the name of the corresponding ID and then you can access the elements data or "record" through that element you created.
Topic archived. No new replies allowed.