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

struct SOlympicsData { string countryName; int gold, silver, broze; }; int getDa

ID: 3618144 • Letter: S

Question

struct SOlympicsData
{
string countryName;
int gold,
silver,
broze;
};

int getData (SOlympicsData[], int);

(it gets an array of SOlympicsData with maximum capacity components opens the data file, read into the array, and return how many countries were read)

void processData (SOlympicsData[], int);

#include

#include

#include

#include

#include

using

const

string countryName[MAX];

int

int

void

int

{

countryNumFile = check(countryName, goldMedals, silverMedals, bronzeMedals);

cout <<

<< countryNumFile << endl << endl;

cout << setw(20) <<

<< setw(10) <<

<< setw(10) <<

<< setw(10) <<

<< setw(20) <<

<< endl;

cout << endl;

{

totalMedals += goldMedals[i] + silverMedals[i] + bronzeMedals[i];

}

calculate(countryName, goldMedals, silverMedals, bronzeMedals, totalMedals, countryNumFile);

cout << endl << endl;

system(

}

int

{

ifstream iFile(

string name;

{

cout <<

exit(1);

}

{

{

countryName[count] = name;

goldMedals[count] = gold;

silverMedals[count] = silver;

bronzeMedals[count] = bronze;

count++;

}

iFile.close();

}

}

void

Explanation / Answer

x.Xlor="red">please rate - thanks your persent calculations are wrong--see comments #include #include #include #include #include using namespace std; const int MAX = 180; string countryName[MAX]; int goldMedals[MAX], silverMedals[MAX], bronzeMedals[MAX]; int check(string[], int[], int[], int[]); void calculate(string[], int[], int[], int[], int);   ////changed int main() { int countryNumFile(0), totalMedals(0); countryNumFile = check(countryName, goldMedals, silverMedals, bronzeMedals); cout