weekly cost calculator using arrays and function decomposition

Hi, I need help with my code for this program that needs to find the total cost of the week for each memeber, show the members with the max and min total cost, and show members with max and min cost per each day of the week. I have tried a lot but the compiler still gives me errors.
#include<iostream>
#include<iomanip>

using namespace std;

const int days=7;
const int costs=3;

void minMax(int b[],int);



int main()
{
int Maximum=0,Minimum=0;

// member arrays with days for rows and the costs for columns
int member1[days][costs]={10,20,35,15,45,40,25,30,65,72,61,33,44,46,84,90,21,37,56,69,70};
int member2[days][costs]={38,24,55,79,82,92,68,19,78,88,34,21,23,95,51,40,21,32,65,81,92};
int member3[days][costs]={77,99,47,91,89,70,33,68,25,78,97,83,39,48,76,43,34,88,55,29,94};
int member4[days][costs]={47,69,88,34,86,73,58,61,96,41,90,72,82,97,88,34,43,78,65,95,85};
int member5[days][costs]={73,96,77,41,68,77,37,16,43,22,80,76,66,59,39,43,34,87,56,59,51};



//printing the arrays
cout<<"\n Member 1 \n"<<endl;
cout<<"\n Food"<<setw(40)<<"Transportation"<<setw(30)<<"Communication"<<endl;
for(int i=0;i<7;i++)
{
for(int j=0;j<3;j++)
cout<<left<< setw(30)<< member1[i][j];
cout<<endl;
}

cout<<"\n Member 2 \n"<<endl;
cout<<setw(20)<<"Food"<<setw(40)<<"Transportation"<<setw(30)<<"Communication"<<endl;
for(int i=0;i<7;i++)
{
for(int j=0;j<3;j++)
cout<<left<<setw(30)<<member2[i][j];
cout<<endl;
}

cout<<"\n Member 3 \n"<<endl;
cout<<setw(20)<<"Food"<<setw(20)<<right<<"Transportation"<<setw(30)<<"Communication"<<endl;
for(int i=0;i<7;i++)
{
for(int j=0;j<3;j++)
cout<<left<<setw(30)<<member3[i][j];
cout<<endl;
}

cout<<"\n Member 4 \n"<<endl;
cout<<setw(20)<<"Food"<<setw(20)<<right<<"Transportation"<<setw(30)<<"Communication"<<endl;
for(int i=0;i<7;i++)
{
for(int j=0;j<3;j++)
cout<<left<<setw(30)<<member4[i][j];
cout<<endl;
}

cout<<"\n Member 5 \n"<<endl;
cout<<setw(20)<<"Food"<<setw(40)<<"Transportation"<<setw(20)<<left<<"Communication"<<endl;
for(int i=0;i<7;i++)
{
for(int j=0;j<3;j++)
cout<<left<<setw(30)<<member5[i][j];
cout<<endl;
}
int total[5]={};
for(int d=0;d<7;d++)
for(int c=0;c<3;c++)

total[0] += member1[d][c];
cout<<"The total cost for member 1 for the week is:"<<total[0]<<endl;

for(int d=0;d<7;d++)
for(int c=0;c<3;c++)

total[1] += member2[d][c];
cout<<"The total cost for member 2 for the week is:"<<total[1]<<endl;

for(int d=0;d<7;d++)
for(int c=0;c<3;c++)

total[2] += member3[d][c];
cout<<"The total cost for member 3 for the week is:"<<total[2]<<endl;

for(int d=0;d<7;d++)
for(int c=0;c<3;c++)

total[3] += member4[d][c];
cout<<"The total cost for member 4 for the week is:"<<total[3]<<endl;

for(int d=0;d<7;d++)
for(int c=0;c<3;c++)
total[4] += member5[d][c];
cout<<"The total cost for member 5 for the week is:"<<total[4]<<endl;

minMax(total,5);

}
//finding the maximum and minimum for the calculated values for the total costs of each member array

int total_day[5]={};

int Maximum=total_day[0];
int Minimum=total_day[0];
for(int j=0;j<5;j++)

if ( Maximum<total_day[i])
{ Maximum=total_day[i];
}


else
{if ( Minimum>total_day[i])
{
Minimum=total_day[i];
}
}
//returning the minimum and maximum for the total cost of arrays
void minMax( int total[],int arraysize)
{
int min=total[0];
for (int n=0;n<arraysize;n++)
{ if (total[n]<min)
min=total[n];
}
int max=total[0];
for(int n=0;n<arraysize;n++)
{
if(total[n]>max)
max=total[n];
}

cout<<"\n The Minimum for the Total Cost of the members:"<<min<<endl;
cout<<"\n The Maximum for the Total Cost of the members is:"<<max<<endl;

system("PAUSE");
}
Topic archived. No new replies allowed.