Question: I need to update this C++ code according to these instructions. I appreciate any help! Here is my code: #include #include #include #include using namespace

I need to update this C++ code according to these instructions. I appreciate any help! I need to update this C++ code according to these instructions. I

Here is my code: #include #include #include #include

using namespace std ;

struct player { string name; int jersynumber; string position; int score;}; bool scoreComparator(player a, player b){ return a.score > b.score;} bool nameComparator(player a, player b){ return a.name > plist[index].name >> plist[index].jersynumber >> plist[index].position >> plist[index].score ; index++; } fin.close(); // returning number of players read return index ; } void printToFile(char filename[], player plist[], int n){ player p ; ofstream fout ; // loading output file object fout.open(filename); // writing every player into a file for (int i = 0; i

int main(int argc, char const *argv[]){ player plist[SIZE] ; int option ; char filename[1000] ; cout > filename ; int n = loadFile(filename, plist); string tp ; int pt ; // a variable to store the choice. int ch; do{ //Main Menu cout> option ; switch(option){ case 0 : cout> ch; switch(ch){ case 1: cout > tp ; searchByPlayerName(plist, n, tp); break ; case 2: cout > pt ; searchByJersy(plist, n, pt); break ; case 3: cout > tp ; searchByPosition(plist, n, tp); break ; default: cout > ch; switch(ch){ case 1: sortByName(plist, n); printToScreen(plist, n); break ; case 2: sortByJersy(plist, n); printToScreen(plist, n); break ; case 3: sortByPosition(plist, n); printToScreen(plist, n); break ; default: cout > filename ; printToFile(filename, plist, n); break ; case 5 : cout

return 0; }

/*file to read from>scores.txt:

Drake 9 LeftWideReceiver 13 Clemont 11 LeftTackle 1 Sean 7 LeftGuard 1 Noah 5 Center 7 Sam 10 RightGuard 1 Will 8 RightTackle 1 Josh 3 TightEnd 6 Matt 4 Quarterback 21 Rob 6 FullBack 6 Timmy 2 HalfBack 6 Eddy 1 RightWideReceiver 13 Alfred 12 Substitution 0 Freddy 16 Substituion 1 Billy 23 Substituiton 3 Tommy 20 Substitution 1 */

Design a class with member variables and appropriate member functions. The member variables required include player names, jersey number, position played, and points each player scored. Use enumeration for at least one member variable

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 Databases Questions!