Lab 6
Arrays of Structs
Announcements
We will have a simple 5 minutes’ quiz at the beginning of the lab on Blackboard. Please sign in to your Blackboard account and finish the quiz individually. Most of your time should be focussed on finishing the lab activity questions.
You must work with a single partner, in a group of 2. You must take turns being the “designated driver” and the “non-driver”. (If there are an odd number of students in the class, your TA will make an adjustment.)
Steps You Need to Do
In this lab, you will have practice about arrays of structs.
We have a database contains records of Youtube videos, in which we store information about:
1) bit.ly link to the video
2) rank of how awesome the video is (a score from 1 to 5)
3) category of the video (H:humor, E:Educational, I:Interesting, G:Gaming, O:Other)
4) brief description (5-7 words) about the video
The program given is able to read records from a text file and filter records by rank or category
Your mission is to rewrite the program that uses arrays of structs to store the information while the given program uses four parallel arrays, one for each attribute of the record.
Stage 0 (1 points)
----------------
Complete the struct Video_struct to make it compatible with the parallel array definition in main().
Rewrite the "readRecords" function so that the function takes arrays of structs as parameters.
Stage 1 (1 points)
----------------
Rewrite the "displayList" function so that the function takes arrays of structs as parameters.
Stage 2 (1 points)
----------------
Rewrite the "filterData" function so that the function takes arrays of structs as parameters.