In my code i got two compiling errors that i cant fix one is mared by (97) and the other is marked by (213)

here is the code

include <iostream>
#include <iomanip>
#include <string>
#include <fstream>

using namespace std;

struct skater
{
string fName, lName;
int entry;
double score[5];
double final;
};
int dataEntry(ifstream&, skater[]);
void scoreEntry(skater[], int);
void format(skater[], int);
void bubblesort(skater[],int count);
void finalScore(skater[], int);
void printname( skater[],int);
void printscore( skater[], int);
void bubblefinal (skater[], int);
void printfinal (skater[], int);
int main()
{
skater person[25];
ifstream infile;
string file;
int count;

cout << "Please enter the file name containing skater names and entry
number" << endl;
cin >> file;
infile.open(file.c_str());
count = dataEntry(infile, person);
infile.close();
format(person, count);
bubblesort(person, count);
printname(person,count);
scoreEntry(person, count);
printscore (person, count);
finalScore(person, count);
bubblefinal (person, count);
printfinal (person, count);
return 0;
}
int dataEntry(ifstream &infile, skater person[])
{
int i = 0;
infile >> person.fName;
infile >> person.lName;
infile >> person.entry;
while (!infile.eof())
{

i++;
if(i >= 25)
break;
infile >> person.fName;
infile >> person.lName;
infile >> person.entry;
}
return i;
}

void scoreEntry(skater person[], int count)
{
double temp = 0;
ifstream infile;
string file;


for (int i = 0; i < count; i++)
for (int k = 0; k < 5; k++)
{
person.score[k] = 0;
}
cout << "Please enter the file name containing skater scores" << endl;
cin >> file;
infile.open(file.c_str());


for (int j = 0; j < count; j++)
{
infile >> temp;
(97) if(infile.peek() != fstream.eofbit && infile.peek() != 10)

{
if(temp == person[j].entry)
{
infile >> temp;
person[j].score[0] = temp;
infile >> temp;
person[j].score[1] = temp;
infile >> temp;
person[j].score[2] = temp;
infile >> temp;
person[j].score[3] = temp;
infile >> temp;
person[j].score[4] = temp;
}
}
}
}
void format (skater person[], int count)
{
int wlen;

for (int i = 0; i < count; i++)
{
wlen = person.fName.length();
person.fName[0] = toupper(person.fName[0]);
person.lName[0] = toupper(person.lName[0]);
for(int j = 1; j < wlen; j++)
{
person.fName[j] = tolower(person.fName[j]);
person.lName[j] = tolower(person.lName[j]);
}
}

}


void bubblesort(skater list[ ],int count)//descending
{
int i;
int j;
skater temp; //used when values are interchanged
for (i=0; i < count-1; i++)
for (j=0; j < count-(i+1); j++)
if (list[j].lName[0] > list[j+1].lName[0])
{
temp = list[j];
list[j] = list[j+1];
list[j+1] = temp;
}
}

void finalScore(skater person[], int count)
{
double sum = 0;
double min;
double max;
for(int i = 0; i < count; i++)
{
min = person.score[0];
max = person.score[0];
for(int j = 0; j < 5; j++)
{
sum = sum+person.score[j];
if (min > person.score[j])
min = person.score[j];
if (max < person.score[j])
max = person.score[j];
}
sum = sum - max;
sum = sum - min;
person.final = sum;
sum = 0;

}
}

void printname(skater person[], int count)
{
cout << fixed << showpoint << setprecision(2);
cout << left <<setw(10) << "NAME" << right << setw(10) << "Entry #" << endl;


for (int i =0; i < count; i++)
{
cout << left <<person.lName << "," << person.fName << right <<
setw (20) << person.entry << endl;
}
cout << " " << endl;

}
void printscore (skater person[], int count)
{
cout << fixed << showpoint << setprecision(1);
cout << " " << endl;
cout << right << setw(25) << "JUDGES' SCORES" << endl;
cout << left << "NAME" << right << setw(30) << "ENTRY #" << setw(5)<< "#1"
<< setw(5) << "#2" << setw(5) << "#3" << setw(5) << "#4" << setw(5) <<
"#5"<< endl;

for (int i =0; i < count; i++)
{
cout << left <<person.lName << "," << person.fName << right
<<setw (7) << right << setw(30) << person.entry << setw(5) <<
person.score[0] << setw(5)<<person.score[1]<< setw(5) <<
person.score[2] << setw(5) << person.score[3]<< setw(5) <\
< person.score[4]<< endl;
}
void bubblefinal (skater person[] , int count);
{
int i;
int j;
double newcount;
newcount = static_cast<double> (count);
skater temp; //used when values are interchanged
for (i=0; i < newcount-1; i++)
for (j=0; j < newcount-(i+1); j++)
(213) if (person[j].final[0] < person[j+1].final[0])
{
temp = person[j];
person[j] = person[j+1];
person[j+1] = temp;
}


}
}

void printfinal (skater person[], int count)
{
cout << " " << endl;
cout<< right << setw(30) << "FINAL" << endl;
cout << left << "NAME" << right <<setw(30) << "SCORE" << endl;
for (int i =0; i < count; i++)
{
cout << left <<person.lName << "," << person.fName << right
<< setw(30) << right << person.final << endl;
}

}
Edit/Delete Message

Please use code tags so we get indenting and line numbers

[code=c++] // Your code here

[/code]

and if you're wanting help with compile errors, maybe you could post the error message?

First: welcome to the board.
Second: when posting code use code tags. Instructions on how to use them are embedded in the watermark of the Message box used to post your thread as well as in the announcement section at the top of the board.
Third:The easier you make it to respond, the more likely you are to get a response. In this case posting error messages would be helpful information.

I'll guess that in (?) line 213 the member variable called final of a skater object is a single variable of type double, not an array, so use of the [] operator after the name final is inappropriate. Use of the [] operator with regard to the variable called score would be appropriate. Either change the name of the variable you are using, or drop the [] depending on your need.

I won't make an attempt to figure out what's going in in (?) line 97. Commenting your intent in addition to posting the error message might help me (or someone else) figure it out.

This article has been dead for over six months. Start a new discussion instead.