C++   Im getting errors and dont know how to fix it. ....................................................   //roster.h #ifndef ROSTER_H #define ROSTER_H #include <vector>   int searchPlayer(vector<int> jerseyNum, int jNum); void displayMenu(); void addPlayer(vector<int> &jerseyNum,vector<int> &rating); void deletePlayer(vector<int> &jerseyNum,vector<int> &rating); void displayAboveRating(vector<int> jerseyNum,vector<int> rating); void updatePlayer(vector<int> &jerseyNum,vector<int> &rating); void display(vector<int> jerseyNum,vector<int> rating);   #endif   ==============================   // Roster.cpp   #include <iostream> #include <vector> using namespace std; #include "Roster.h"   int searchPlayer(vector<int> jerseyNum, int jNum) { for (unsigned int i = 0; i < jerseyNum.size(); i++) { if (jerseyNum[i] == jNum) return i; } return -1;   } void displayMenu() { cout << "\nMENU" << endl; cout << "a - Add Player" << endl; cout << "d - Delete Player" << endl; cout << "u - Update Player Rating" << endl; cout << "r - Output Players above a rating" << endl; cout << "o - Output Roster" << endl; cout << "q - Quit" << endl;    cout << "Enter Choice :"; } void addPlayer(vector<int> &jerseyNum,vector<int> &rating) { int jnum,rate; cout << "Enter a new Player's jersey number :"; cin >> jnum; cout << "Enter the player's rating :"; cin >> rate;    jerseyNum.push_back(jnum); rating.push_back(rate); } void deletePlayer(vector<int> &jerseyNum,vector<int> &rating) { int jnum; cout << "Enter a Player's jersey number :"; cin >> jnum; int index = searchPlayer(jerseyNum, jnum); if (index == -1) { cout << "** Player not found **" << endl; } else { jerseyNum.erase(jerseyNum.begin() + index); rating.erase(rating.begin() + index); } } void displayAboveRating(vector<int> jerseyNum,vector<int> rating) { int rate; cout << "Enter a rating :"; cin >> rate; cout << "ABOVE " << rate << endl; for (unsigned int i = 0; i < jerseyNum.size(); i++) { if (rating[i] > rate) { cout << "Player" << (i + 1) << " -- Jersey Number:" << jerseyNum[i] << ", Rating:" << rating[i] << endl; } } }   void updatePlayer(vector<int> &jerseyNum,vector<int> &rating) { int jnum,rate; cout << "Enter a Player's jersey number :"; cin >> jnum; int index = searchPlayer(jerseyNum, jnum); if (index == -1) { cout << "** Player not found **" << endl; } else { cout << "Enter the player's rating :" << endl; cin >> rate; rating[index] = rate; } }   void display(vector<int> jerseyNum,vector<int> rating) { cout << "ROSTER" << endl; for (unsigned int i = 0; i <jerseyNum.size(); i++) { cout << "Player" << (i + 1) << " -- Jersey Number:" << jerseyNum[i] << ", Rating:" << rating[i] << endl; } }   ======================================   // main.cpp   #include <iostream> #include <vector> using namespace std; #include "Roster.h"   int main() { int jnum,rate; char choice; vector<int> jerseyNum; vector<int> rating;    for(int i=0;i<5;i++) { cout<<"Enter player "<<(i+1)<<"'s jersey number: "; cin>>jnum; jerseyNum.push_back(jnum);    cout<<"Enter player "<<(i+1)<<"'s rating: "; cin>>rate; rating.push_back(rate);    }    while(true) { displayMenu(); cin>>choice; // Based on the user choice the corresponding case will executed switch (choice) { case 'a': { addPlayer(jerseyNum,rating);    } continue; case 'd': { deletePlayer(jerseyNum,rating);       continue; } case 'u': { updatePlayer(jerseyNum,rating); continue; } case 'r': { displayAboveRating(jerseyNum,rating);    continue; } case 'o': { display(jerseyNum,rating);   continue; } case 'q': { cout << "** PROGRAM EXIT**" << endl; break; } default: { cout << "Invalid Choice" << endl; continue; } } break; }      return 0; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++

 

Im getting errors and dont know how to fix it.

....................................................

 

//roster.h

#ifndef ROSTER_H

#define ROSTER_H

#include <vector>

 

int searchPlayer(vector<int> jerseyNum, int jNum);

void displayMenu();

void addPlayer(vector<int> &jerseyNum,vector<int> &rating);

void deletePlayer(vector<int> &jerseyNum,vector<int> &rating);

void displayAboveRating(vector<int> jerseyNum,vector<int> rating);

void updatePlayer(vector<int> &jerseyNum,vector<int> &rating);

void display(vector<int> jerseyNum,vector<int> rating);

 

#endif

 

==============================

 

// Roster.cpp

 

#include <iostream>

#include <vector>

using namespace std;

#include "Roster.h"

 

int searchPlayer(vector<int> jerseyNum, int jNum)

{

for (unsigned int i = 0; i < jerseyNum.size(); i++)

{

if (jerseyNum[i] == jNum)

return i;

}

return -1;

 

}

void displayMenu()

{

cout << "\nMENU" << endl;

cout << "a - Add Player" << endl;

cout << "d - Delete Player" << endl;

cout << "u - Update Player Rating" << endl;

cout << "r - Output Players above a rating" << endl;

cout << "o - Output Roster" << endl;

cout << "q - Quit" << endl;

  

cout << "Enter Choice :";

}

void addPlayer(vector<int> &jerseyNum,vector<int> &rating)

{

int jnum,rate;

cout << "Enter a new Player's jersey number :";

cin >> jnum;

cout << "Enter the player's rating :";

cin >> rate;

  

jerseyNum.push_back(jnum);

rating.push_back(rate);

}

void deletePlayer(vector<int> &jerseyNum,vector<int> &rating)

{

int jnum;

cout << "Enter a Player's jersey number :";

cin >> jnum;

int index = searchPlayer(jerseyNum, jnum);

if (index == -1)

{

cout << "** Player not found **" << endl;

}

else

{

jerseyNum.erase(jerseyNum.begin() + index);

rating.erase(rating.begin() + index);

}

}

void displayAboveRating(vector<int> jerseyNum,vector<int> rating)

{

int rate;

cout << "Enter a rating :";

cin >> rate;

cout << "ABOVE " << rate << endl;

for (unsigned int i = 0; i < jerseyNum.size(); i++)

{

if (rating[i] > rate)

{

cout << "Player" << (i + 1) << " -- Jersey Number:" << jerseyNum[i]

<< ", Rating:" << rating[i] << endl;

}

}

}

 

void updatePlayer(vector<int> &jerseyNum,vector<int> &rating)

{

int jnum,rate;

cout << "Enter a Player's jersey number :";

cin >> jnum;

int index = searchPlayer(jerseyNum, jnum);

if (index == -1)

{

cout << "** Player not found **" << endl;

}

else

{

cout << "Enter the player's rating :" << endl;

cin >> rate;

rating[index] = rate;

}

}

 

void display(vector<int> jerseyNum,vector<int> rating)

{

cout << "ROSTER" << endl;

for (unsigned int i = 0; i <jerseyNum.size(); i++)

{

cout << "Player" << (i + 1) << " -- Jersey Number:" << jerseyNum[i]

<< ", Rating:" << rating[i] << endl;

}

}

 

======================================

 

// main.cpp

 

#include <iostream>

#include <vector>

using namespace std;

#include "Roster.h"

 

int main()

{

int jnum,rate;

char choice;

vector<int> jerseyNum;

vector<int> rating;

  

for(int i=0;i<5;i++)

{

cout<<"Enter player "<<(i+1)<<"'s jersey number: ";

cin>>jnum;

jerseyNum.push_back(jnum);

  

cout<<"Enter player "<<(i+1)<<"'s rating: ";

cin>>rate;

rating.push_back(rate);

  

}

  

while(true)

{

displayMenu();

cin>>choice;

// Based on the user choice the corresponding case will executed

switch (choice)

{

case 'a':

{

addPlayer(jerseyNum,rating);

  

}

continue;

case 'd':

{

deletePlayer(jerseyNum,rating);

  

  

continue;

}

case 'u':

{

updatePlayer(jerseyNum,rating);

continue;

}

case 'r':

{

displayAboveRating(jerseyNum,rating);

  

continue;

}

case 'o':

{

display(jerseyNum,rating);

 

continue;

}

case 'q':

{

cout << "** PROGRAM EXIT**" << endl;

break;

}

default:

{

cout << "Invalid Choice" << endl;

continue;

}

}

break;

}

  

 

return 0;

}

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education