I am confused by the question and having trouble designing the logic(pseudocode) for this problem, any help would be beneficial and appreciated..

Heartland Community College has a file of student records sorted by the hour of the student's first class on Mondays this semester. The hour of the first class is a two-digit number based on a 24-hour clock (for example, a 1pm class is recorded as 13). Besides the hour, each record contains the student's name and town of residence. Create the logic to produce a report that students can use to organize carpools. The report lists the names and phone numbers of students from the city of Huntley.(Note that some students come from cities other than Huntley; these students should not be listed on the report.) Start a new group for each hour of the day, including the hour in a header that precedes the group.

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Chilton

You could either sort the students into corresponding times before you start ( a little faster )

or iterate through the array of students 24 times, checking the time each time.

You want to sort the students into there corresponding times

``````so create arrays of students[24][MAX_STUDENTS]
Then iterate all students and then put each into there corresponding hours.

then you want to iterate through the times in the array 0 - 23
print the time index +1
then iterate through each student in that array (until no more students  are left )
and print the name``````

You can create an array of structs that can hold those three pieces of data. Afterwards, sorting based on the hours can be done, starting with those from hour 0 - 23.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.