Question
C Programming: inventory recording program: Construct a program for a game-store that stores info regarding sales figures for games in their inventory. The program shall
C Programming: inventory recording program:
Construct a program for a game-store that stores info regarding sales figures for games in their inventory.
The program shall use an array of structures to store this information.
This program shall prompt the user for the number of games to enter. Then the program should prompt the user to type in the title of each game, and the number sold of that game, and a number indicating the games genre.
After all the data has been entered, display the list of games, number ordered, and a text value indicating the genre.
Requirements
The games title is entered as whole-line input, and this information may include spaces.
Inventory information for each game must be stored in a structure containing the title of the game (a string of size 16), the quantity sold, and an enumerated type indicating the genre. The inventory for the store is stored as an array of these structures.
The genre enumerated data type must use these enumeration constants, in this order: action, rpg, simulation, strategy, sports.
You must use a function calledget_game_infoto read the information for each game from the user. This function needs one argument: the current element of the game array as an output parameter. Remember, each element of this array is a structure! This function has no return value.
This function must display a message if the length of the game title exceeds 15 characters. Always set the last element in the string to the null character, regardless of the length.
This function must also check that the value entered for the genre is within the correct range for the enum values (as noted in #3 above). Your code must continue to ask the user for a correct genre, as in the sample run. The check must use the enum constants, not the numbers represented by the enums.
You must use a function calleddisplay_game_infoto display the contents of the games array. This function has two arguments: the array of game structures and the number of games in inventory (which is the size of the array).
This function must use a switch statement to determine which genre text to print. Remember, the genre for each game is stored as an enum value, not as a string. Your output should display actual words, like RPG or Strategy.
***Please include as many comments as possible as I will be comparing my program to yours, Thanks***
The output must be neatly formatted and line up exactly as in the sample run.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started