I. Use the diagrams shown to answer the questions A. Write the structure definit
ID: 3622027 • Letter: I
Question
I. Use the diagrams shown to answer the questions
A. Write the structure definitions based on the following diagrams. Use nested (struct within struct) structs where appropriate.
B. Using your structs for A, declare an array of Soundtrack structs that has 50 elements.
C. Assign the following values to the first 2 elements in the Soundtrack array:
Field Name Value Set 1 Value Set 2
First Miklos Elmer
Last Rozsa Bernstein
Catalog Number 72197 VCL 8124
Recording Year 1959 1963
Release Year 1996 2004
Name Rhino Varese Sarabande
Film Ben-Hur The Great Escape
D. Create a function to display all the data in t
he Soundtrack array.
E. Write a function call to the function
you created.
Explanation / Answer
Dear user,
A) Use nested (struct within struct) structs :
Consider diagram soundtrack contains lot of information is packed into one struct. This struct has 10 memebers. Now let us reorganize this struct as follows:
struct Composer
{
string First;
string Last;
};
struct Label
{
int CatalogNumber;
string Name;
};
struct DateData
{
int RecordingYear;
int ReleaseYear;
};
Now finally build the soundtrack as follows:
struct Soundtrack
{
Composer ctrack;
Label ltrack;
string Film;
};
-------------------------------------------------------------------------------------------------------------
B) Consider structs for A, declare an array of Soundtrack structs that has 50 elements. Then
const int ARRAY_SIZE=50;
struct Soundtrack
{
int A[ARRAY_SIZE);
Composer ctrack;
Label ltrack;
string Film;
};