Question: Write a program that stores the following data about a video game in a structure: C++ Field Name Description title string (name of game) genre

Write a program that stores the following data about a video game in a structure:

C++

Field Name

Description

title

string (name of game)

genre

enum (type of game)

rank

int

time

float/double

Use an enumerated type for the genre field that contains the following enumerators: FPS, Strategy, RolePlay

The program should create an array of 5 game structures and initialize it with the following information:

Title

Genre

Rank

Time (days)

League of Legends

Strategy

3

9.50

Team Fortress 2

FPS

5

16.75

Ultima 7: The Black Gate

RolePlay

1

4.25

Halo

FPS

2

0.75

Command and Conquer: Red Alert

Strategy

4

6.75

Use a menu-driven interface to allow the user to:

Print the information for all games, sorted in decreasing order by rank, in table form. (For each game, build a String by CONCATENATING the 4 fields, then print).

Print the information for a specific game, using a full or partial title match. (Take user input as a String, use both find() and compare() member functions for search and compare).

Print the total time spent for all games.

Print the average rank for all games.

Let the user stay in the loop and keep choosing, until the user enters -1.

Your program should be modular with separate functions for input and each part of the processing. At a minimum, each choice (above) must have its own function. Your output should be well-organized, neat, and easy to read. Write comments describing what each function does.

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!