You will need to search for the game needed (in another loop inside the main loop) for
Question:
Inside of the main loop, when the user wants to enter a new game, which they must do before seeing any scores, give the user the ability to enter up to 10 games and their initial scores . After the first game is entered, the other menu options become valid and new games up to 10 may be entered at any time.
Your output should show the user entering incorrect values and the error checking you are doing, as in the last program as well as the entering of 3 or more games (maximum 10) and after games are entered, the checking and updating of score information and number of times played. [NOTE: this will probably require multiple screen captures to see the entire output.]
c++
#include
#include
#include
using namespace std;
class VideoGame {
private:
string name;
int highScore;
int numOfPlays;
public:
VideoGame() {
name = "NA";
highScore = 0;
numOfPlays = 0;
}
VideoGame(string n, int score, int num) {
name = n;
highScore = score;
numOfPlays = num;
}
VideoGame(string n) {
name = n;
highScore = 0;
numOfPlays = 0;
}
VideoGame(const VideoGame &p2)
{
name = p2.name;
highScore = p2.highScore;
numOfPlays = p2.numOfPlays;
}
void setName(string n) {
name = n;
}
void setHighScore(int score) {
highScore = score;
}
void setNumOfPlays(int num) {
numOfPlays = num;
}
string getName() {
return name;
}
int getHighScore() {
return highScore;
}
int getNumOfPlays() {
return numOfPlays;
}
};
string inputName() {
string n;
cout
getline(cin >> ws, n);
return n;
}
int inputHighScore() {
int score;
cout
cin >> score;
return score;
}
int inputNumOfPlays() {
int num;
cout
cin >> num;
return num;
}
void output(VideoGame game) {
cout
}
int main() {
VideoGame game1, game2, game3("VideoGame 3");
game1.setName(inputName());
game1.setHighScore(inputHighScore());
game1.setNumOfPlays(inputNumOfPlays());
cout
output(game1);
cout
game2.setName(inputName());
game2.setHighScore(inputHighScore());
game2.setNumOfPlays(inputNumOfPlays());
cout
output(game2);
cout
output(game3);
VideoGame game4 = game2;
cout
output(game4);
return 0;
}