Write a program that shows Game sales. The program should use a structure to store the following data about the Game sale: Game company Type of Game (Action, Adventure, Sports etc.) Year of Sale Sale Price The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program should have a menu driven interface. Input Validation: When the data for a new game sale is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a “Sale Price” of the Game An example: You will use 1 structure only and then manipulate that for working with the information. The program should use an array of at least 3 structures (3 variables of the same structure). An example of the structure: struct Game { string name; string type; int year; double price; };
Write a
Game company
Type of Game (Action, Adventure, Sports etc.)
Year of Sale
Sale Price
The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program should have a menu driven interface.
Input Validation: When the data for a new game sale is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a “Sale Price” of the Game
An example:
You will use 1 structure only and then manipulate that for working with the information.
The program should use an array of at least 3 structures (3 variables of the same structure).
An example of the structure:
struct Game
{
string name;
string type;
int year;
double price;
};
So far I have written that ...
![File
Edit
View
Project
Build
Debug
Test
Analyze
Tools
Extensions
Window
Help
Search (Ctrl+Q)
ConsoleApplication23
BM
Debug
x86
> Local Windows Debugger - Auto
IA Live Share
AT
ConsoleApplication23.cpp* + X
E ConsoleApplication23
(Global Scope)
O main)
43
for (int i = 0; i < sz; i++)
{
cout << "\nGame name:
44
« arr[i].name <« endl;
cout <« "Game type" <« arr[i].type <« endl;
cout <« "Game Year" << arr[i].year << endl;
cout <« "Game Price" <« arr[i].price << endl;
45
" «
46
47
48
49
50
cin.ignore();
cout <« "\nPress enter to continue..." << endl;
51
52
53
54
55
int main()
{
56
57
58
int ch = 0;
int i = 0, f = 0;
59
60
61
int num = 0;
62
Game cus_acc_arr[3];
menuInterface(();
cout <« "Please enter a choice: ";
cin >> ch;
63
64
65
66
67
68
if (ch == 1)
{ NewGame (cus_acc_arr, i);
i++;}|
69
70
71
72
else if (ch == 2)
{(cus_acc_arr, num, i); }
73
74
75
100 %
2
Ln: 71
Ch: 18
SPC
CRLF
Output
Show output from: Debug
12:41 PM
P Type here to search
11/20/2020
Diagnostic Tools
近](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9a97ba81-ff9a-4f61-847e-dc642b7f64cf%2F18267e22-a999-4a79-a1c8-789039b622e5%2Fxda7f6_processed.png&w=3840&q=75)
![File
Edit
View
Project
Build
Debug
Test
Analyze
Tools
Extensions
Window
Help
Search (Ctrl+Q)
ConsoleApplication23
BM
7 2 - S - Debug
> Local Windows Debugger - Auto
x86
IA Live Share
T
ConsoleApplication23.cpp* + x
A ConsoleApplication23
(Global Scope)
O main)
10
double price;
11
12
13
Evoid menuInterface ()
14
15
cout « "Hello please choose one of the following options" <« endl;
cout <« "1. Enter Game Information" << endl:
cout <« "2. Change Game Information" << endl;
cout <« "3. Show All Games" << endl:
16
17
18
19
cout << "4. Exit" << endl;
20
21
22
Evoid NewGame (struct Game arr[], int ind)
{
cout <« "\nPlease Enter Game Name: ";
cin.ignore();
getline(cin, arr[ind].name);
cout <« "Enter Game Type ";
23
24
25
26
27
getline(cin, arr[ind].type);
cout <« "Enter Year Game Was Sold";
cin >> arr[ind].year;
cout <« "Enter Price Of Game";
cin >> arr[ind].price;
28
29
30
31
32
33
34
35
Evoid EditGame (struct Game arr[], int ind)
{
36
37
38
cout
39
40
Evoid GameInfo(struct Game arr[], int sz)
{
41
42
100 %
01
A
2
Ln: 71
Ch: 18
SPC
CRLF
Output
Show output from: Debug
12:41 PM
P Type here to search
11/20/2020
Diagnostic Tools
近](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9a97ba81-ff9a-4f61-847e-dc642b7f64cf%2F18267e22-a999-4a79-a1c8-789039b622e5%2Fcluj49xb_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 6 images









