Help with Error message/ Opening Input & Output files

I need some direction with the following program. It is called star search. When I try to run the program, I keep getting the following error message: 'sh: pause: command not found'. In addition to that the program won't read from the input and output files that I have created.

Below are the program instructions. If you do not care to read, please scroll down to see the code that I have created so far. Thanks.

Instructions
Your program will have an input file that will consist of a list of contestants. The first line of the file is an integer that says how many contestants are in the file. Each line is for one contestant and each line in the file would have the following format (the name of the input file starsearch.dat):
Contestant Name(no spaces) score1 score2 score3 score4 score5

Your program will have a function called string contestantName() that takes the file object as a reference parameter and reads the file for the name of the contestant on the current line and returns the name. This function should be called from main, once for each line of the file.
The void getJudgeData() will read from the file and not from the user. This function will still use a reference parameter for the score, and it will read the next score from the file. This function will be called five times per contestant and is called from main once for each score.
The void CalcScore() is used to calculate the score using the same formulation. However, this function will write the contestants name and score to an output file. The function will have 7 parameters instead of 5: output file (pass by reference), contestants' name, and the 5 judges scores.
The output file will be a list of contestants, where each line has the following format (name the output file results.dat):
Contestant Name(name contains no spaces) Final_Score

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

using namespace std;

//Function Prototypes
void calcScore (double);
void getJudgeData (double);
string contestantName(ifstream & );

double calculatescore;
double findLowest(double &lowestScore);
double findHighest(double &highestScore);
int score1, score2, score3, score4, score5, lowestScore, highestScore, totalScore;
string contName;

ifstream inputFile;
ofstream outputFile;

int main()

{
{
ifstream thefile ("starsearch.dat"); //Input file
int name; //Name of contestant
while (thefile >> name >> score1 >> score2 >> score3 >> score4 >> score5) {
{cout << name << "," << score1 << "" << score2 << ", "<< score3 << ", " << score4 << ", " << score5 << ", ";}
if (!thefile){ //file opening error
cerr << "File will not open.";
exit(1);
}
}
}
//contestant name function

for (int count = 0; count < 2; count++)
{

string contestantName(contName);
for (int count = 0; count < 5; count++)
{



}

}
system ("pause");
}


string contestantName (string contName)
{

const int size = 81;
char name[size];

contName = name;

inputFile >> contName;

return contName;
}

double getJudgeData( ifstream& ifs )
{
inputFile>>score1>>score2>>score3>>score4>>score5;



{
void getJudgeData (double);
}
int findLowest(double &lowestScore);
{

if ((score1 <= score2) && (score1 <= score3) && (score1 <= score4) && (score1 <= score5))
{
lowestScore = score1;
}

else if ((score2 <= score1) && (score2 <= score3) && (score2 <= score4) && (score2 <= score5))
{
lowestScore = score2;
}

else if ((score3 <= score1) && (score3 <= score2) && (score3 <= score4) && (score3 <= score5))
{
lowestScore = score3;
}

else if ((score4 <= score1) && (score4 <= score2) && (score4 <= score3) && (score4 <= score5))
{
lowestScore = score4;
}

else if ((score5 <= score1) && (score5 <= score2) && (score5 <= score3) && (score5 <= score4))
{
lowestScore = score5;
}
return lowestScore;

}


double findHighest(double &highestScore);
{

if ((score1 >= score2) && (score1 >= score3) && (score1 >= score4) && (score1 >= score5))
{
highestScore = score1;
}

else if ((score2 >= score1) && (score2 >= score3) && (score2 >= score4) && (score2 >= score5))
{
highestScore = score2;
}

else if ((score3 >= score1) && (score3 >= score2) && (score3 >= score4) && (score3 >= score5))
{
highestScore = score3;
}

else if ((score4 >= score1) && (score4 >= score2) && (score4 >= score3) && (score4 >= score5))
{
highestScore = score4;
}

else if ((score5 >= score1) && (score5 >= score2) && (score5 >= score3) && (score5 >= score4))
{
highestScore = score5;
}
return highestScore;

}

{
void CalcScore (double &totalScore);

}
double findLowest(double lowestScore);
double findHighest(double highestScore);

totalScore = (((score1+score2+score3+score4+score5)-(lowestScore+highestScore))/3.0);

return totalScore;
}
Last edited on
Any suggestions would be helpful. I am currently working on problem and will update soon.
Topic archived. No new replies allowed.