Question: please help initializeReflist ( ) ; readRefereeInfo ( ) ; int choice; do { system ( CLS ) ; choice = menu (

please help
initializeReflist();
readRefereeInfo();
int choice;
do {
system("CLS");
choice = menu();
switch (choice){
case 1:
listAllReferees();
break;
case 2:
listRefereesOfSpecificGrade();
break;
case 3:
Quit();
break;
default:
cout "That was an invalid choice, please try again!
";
}
system("PAUSE");
} while (choice >0 && choice 3);
system("PAUSE");
return 0;
}
int menu()
{
int option;
cout " REFEREE SYSTEM
";
cout "1. List All Referees.
";
cout "2. List All Referees of A Specific Grade.
";
cout "3. Quit.
";
cout "Please select your option: ";
cin >> option;
while (option 1|| option >3)
{
cout "Invalid option!!! Please select valid option: ";
}
cin >> option;
return option;
}
void initializeReflist()
{
SReferee defaultRef ={"0000", UNKNOWN };
for (int i =0; i REFEREE_LIST_SIZE; i++)
referees[i]= defaultRe\overline{f};
}
void listAllReferees()
{
```
```
i++;
}
if (!found)
cout "NO Referees found!!!" endl;
}
void Quit()
{
// Write Referee information back from the referee array to the file Referees.txt
writeRefereeInfo();
cout "Have a nice day
";
}
void readRefereeInfo()
{
// Read Referee information from the file Referees.txt to the referee array
ifstream inFile;
inFile.open("Referees.txt");
if (inFile.fail())
{
cout "Error open the input file... Exiting
";
}
exit(1);
string tempStr;
int i =0;
while (inFile >> referees[i].id)
{
// Add your code here to
//1. read from the file Referees.txt the grade as the to the tempStr
//2. convert the grade in string to grade in RefereeGrade
//3. then assign the converted grade to the referees[i].grade
referees[i].grade = stringToGrade(tempStr);
i++;
}
inFile.close();
}
void writeRefereeInfo()
{
ofstream outFile;
outFile.open("Referees.txt");
if (outFile.fail())
{
cout "Error open the output file... Exiting
";
}
exit(1);
int i =0;
while (i REFEREE_LIST_SIZE)
{
if (referees[i].id !="0000")
{
``````
outFile referees[i].id "\t";
// Add your code here to
//1. convert the grade in RefereeGrade to the corresponding string
//2. write the converted string to the file Referees.txt
outFile endl;
}
i++;
}
outFile.close();
}
string gradeToString(RefereeGrade g)
{
switch (g){
case CLUB:
return "CLUB";
case STATE:
return "STATE";
case NATIONAL:
return "NATIONAL";
case FIFA:
return "FIFA";
default:
return "UNKNOWN";
}
}
RefereeGrade stringToGrade(string s)
{
if (s == "CLUB")
return CLUB;
else if (s == "STATE")
return STATE;
else if (s == "NATIONAL")
return NATIONAL;
else if (s == "FIFA")
return FIFA;
else
return UNKNOWN;
}
```
please help initializeReflist ( ) ;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!