Lab07 A
Lab07 A
Q-2.
Download sort.cpp. The program defines an array called course with six
cstrings representing the course titles. Complete the program by sorting
course in an ascending alphabetical order.
Hints: You can use strcmp() for comparison.
The output of your program should look like the following:
C++ Programming
Data structures
English
Internet
Java Programming
Mathematics
Q-3. [Optional]
Download opt.cpp. The program defines an array with 10 cstrings
representing the students list, and an array with 6 cstrings representing the
course list. The program has already randomly assigned each student to
register one course. Complete the program so that it can
1) count the number of registrations for each course.
2) print the course list in descending order according to the number of registrations.
3) print the registered students’ names for each course and students’ names should
be sorted in ascending alphabetical order.
1/2
CS2311 Computer Programming 2024-25A
Note: Your actual output is likely to be different from the expected output if you're not using
Microsoft Visual C++ 2019 (PASS). In case of any inconsistency between your output
and PASS output, the PASS output shall prevail.
Expected Outputs:
Enter the seed for random number generation:
2019
James registers English
Iverson registers Internet
Wade registers Data structures
Jordan registers English
George registers C++ Programming
Curry registers Mathematics
Westbrook registers Mathematics
Durant registers Java Programming
Kobe registers Java Programming
Harden registers English
Students' list:
Curry
Durant
George
Harden
Iverson
James
Jordan
Kobe
Wade
Westbrook
2/2