Computer Science > Research Paper > University of California, RiversideCS 012main.cpp (All)
#include <iostream> #include <vector> using namespace std; // parameter order will always be jersey #s then ratings void outputRoster(const vector<int>& modjersey , const vector<int>& modrating); ... void addPlayer(vector<int> &modjersey, vector<int> &modrating); void removePlayer(vector<int> &modjersey, vector<int> &modrating); void updatePlayerRating(const vector<int> &modjersey, vector<int> &modrating); void outputPlayersAboveRating(const vector<int> &modjersey, const vector<int> &modrating); int main() { vector<int> jersey(5); vector<int> rating(5); int number; int rate; for (int i = 0; i <5; ++i){ cout << "Enter player " << i+1 << "'s jersey number:" << endl; cin >> number; jersey.at(i) = (number); cout << "Enter player " << i+1 << "'s rating:" << endl << endl; cin >> rate; rating.at(i) = (rate); } cout << "ROSTER" << endl; for (int i = 0; i <5; ++i){ cout << "Player " << i+1 << " -- Jersey number: " << jersey.at(i) << ", Rating: " << rating.at(i) << endl; } cout << endl << "MENU" << endl << "a - Add player" << endl << "d - Remove player" << endl << "u - Update player rating" << endl << "r - Output players above a rating" << endl; cout << "o - Output roster" << endl << "q - Quit" << endl << endl << "Choose an option:" << endl; char userInput; cin >> userInput; while (userInput != 'q'){ if(userInput == 'a'){addPlayer(jersey,rating);} else if(userInput =='d'){removePlayer(jersey,rating);} else if(userInput == 'u'){updatePlayerRating(jersey,rating);} else if(userInput == 'r'){outputPlayersAboveRating(jersey,rating);} else if(userInput == 'o'){outputRoster(jersey,rating);} else if(userInput == 'q'){return 0;} cout << endl << "MENU" << endl << "a - Add player" << endl << "d - Remove player" << endl << "u - Update player rating" << endl << "r - Output players above a rating" << endl; cout << "o - Output roster" << endl << "q - Quit" << endl << endl << "Choose an option:" << endl; cin >> userInput; } return 0; [Show More]
Last updated: 2 years ago
Preview 1 out of 3 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Jun 08, 2021
Number of pages
3
Written in
This document has been written for:
Uploaded
Jun 08, 2021
Downloads
0
Views
71
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·