touch up trouble

I am trying to finish my c++ program. however I have hit a wall. I am reading in a file sorting it. Then every time the team name changes there needs to be a summery.


int main()
{
receivers Data [100];
int size= c;
ofstream outData;
ifstream inData;
receivers st;
inData.open("RecStats.txt"); reveivers stats file
outData.open("validationReport.txt");

void swap(receivers A[],int i,int j)
{
record temp = A[i];
A[j] = A[j];
A[j]=temp; //swap function
return;

}


void sort(receivers A[],int size)
{
for(int p=1; p < size; p++) // sort function
{
for(int c=0; c < size -p; c++)
{
if(A[c].team> A[c+1].team) swap(A,c,c+1);
}
}
return;
}

int reg = Data[0].Receptions; have to be updated
double sum = Data[0].Yards;

outData << Data[0];

for( int j=1 ; j<size ; j++)

{
if (Data[j].Receptions==reg)
{
outData<<Data[j];
sum=sum+Data[j].Yards;
}

else{
outData <<"Total yards are "<< Yards << endl;
outData<<Data[j];
reg=Data[j].Receptions;
sum=Data[j].Yards;
}

};



}
closed account (o3hC5Di1)
Hi there,

Please be a little more specific about the problem. Are you getting any errors? Is the program not outputting what you expect it to? Or are you stuck on a particular part of the assignment?

On a sidenote, please wrap your code with [code][/code]-tags, it makes it more readable.

All the best,
NwN
Topic archived. No new replies allowed.