Lab 6

Arrays of Structs

Announcements

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.