Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'ve been trying to figure out why this code will not compile for at least an h

ID: 3643406 • Letter: I

Question

I've been trying to figure out why this code will not compile for at least an hour or two. Someone please help me. I know it has something to do with passing the function displayData. Here is the complete code. I'll put the error message (build output) that my compiler (Visual Studio) is giving me after the code.

#include <iostream>
#include <string>
using namespace std;


struct DateData
{
int recording_year;
int release_year;
};

struct Label
{
string catalog_number;
DateData dates;
string name;
};

struct Composer
{
string first;
string last;
};

struct Soundtrack
{
Composer person;
Label info;
string film;
};

void displayData (const Soundtrack[]);

int main()
{
Soundtrack record[2];

record[0].person.first = "Miklos";
record[0].person.last = "Rozsa";
record[0].info.catalog_number = "72197";
record[0].info.dates.recording_year = 1959;
record[0].info.dates.release_year = 1996;
record[0].info.name = "Rhino";
record[0].film = "Ben-Hur

Explanation / Answer

please rate.

your program is correct but there is a spelling mistake in your program.

I have highlighted it below.

#include <iostream>
#include <string>
using namespace std;


struct DateData
{
int recording_year;
int release_year;
};

struct Label
{
string catalog_number;
DateData dates;
string name;
};

struct Composer
{
string first;
string last;
};

struct Soundtrack
{
Composer person;
Label info;
string film;
};

void displayData (const Soundtrack[]); // The same spelling should be used below

int main()
{
Soundtrack record[2];

record[0].person.first = "Miklos";
record[0].person.last = "Rozsa";
record[0].info.catalog_number = "72197";
record[0].info.dates.recording_year = 1959;
record[0].info.dates.release_year = 1996;
record[0].info.name = "Rhino";
record[0].film = "Ben-Hur”";
record[1].person.first = "Elmer";
record[1].person.last = "Bernstein";
record[1].info.catalog_number = "VCL 8124";
record[1].info.dates.recording_year = 1963;
record[1].info.dates.release_year = 2004;
record[1].info.name = "Varese Sarabande";
record[1].film = "The Great Escape";

displayData(record);

return 0;
}

void diplayData (const Soundtrack record[]) // This should be displayData
{
for (int count = 0; count < 2; count++)
{
cout << "Soundtrack #" << (count + 1) << endl
<< "Composer full name: " << record[count].person.first << record[count].person.last << endl
<< "Catalog Number: " << record[count].info.catalog_number << endl
<< "Recording Year: " << record[count].info.dates.recording_year << endl
<< "Release Year: " << record[count].info.dates.release_year << endl
<< "Name: " << record[count].info.name << endl
<< "Film: " << record[count].film << endl;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote