739
f. inttotalKids = 0 ;
intbestSchool = 0 ;
for(introw = 0 ; row < NUM_SCHOOLS; row++)
for(intcolumn = 0 ; column < NUM_SPORTS; column++)
totalKids = totalKids + kidsInSports[row][col];
// totalKids contains the total of all the kids in sports
g.intbestTotal= 0 ;
intbestSchool = 0 ;
for(introw = 0 ; row < NUM_SCHOOLS; row++)
{
inttotalKids = 0 ;
for(intcolumn = 0 ; column < NUM_SPORTS; column++)
totalKids= totalKids + kidsInSports[row][column];
if(totalKids > bestTotal)
{
bestTotal = totalKids;
bestSchool = row;
}
}
// bestSchool contains the number of the school with the
// most kids participating in sports
h.doublebestTotal = 0.0;
intbestSport;
for(introw = 0 ; row < NUM_SPORTS; row++)
{
doubletotalMoney = 0.0;
for(intcolumn = 0 ; column < NUM_SCHOOLS; column++)
totalMoney = totalMoney + costOfSports[row][column];
if(totalMoney > bestTotal)
{
bestTotal = totalMoney;
bestSport = row;
}
}
// bestSport contains the most popular sport in terms of
// money spent
i. intnumberOfKids = 0 ;
intbestSport = 0 ;
for(intcolumn = 0 ; column < NUM_SPORTS; COLUMN++)
{
inttotalKids = 0 ;
for(introw = 0 ; row < NUM_SCHOOLS; row++)
totalKids = totalKids + kidsInSports[row][column];