Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Turn in: your program (cpp file) nterlu understand th structu working on will be creating a structure to store information about the player in
C++
Turn in: your program (cpp file) nterlu understand th structu working on will be creating a structure to store information about the player in your In this lab, you adventure game. A structure combines multiple pieces of data into one program defined type. So you can make one data structure that includes an int (to store the amount of gold collected), an array of characters (to store the player's name), a double (to store the amount of health the player has left), etc. Then that collection of data can be referred to by a single name The first part of the lab is to decide what data needs to be stored regarding the character (health, money collected, lives left, astrological sign, favorite movie, etc). This part is almost completely up to you. However, you should have at least three pieces of data, including one integer and one array of characters Once you decide what pieces of data will go into your structure you need to write a program that efines the structure and unctions to t Iniialization Function: this function should set the values of a new copy o that you have created. For example, if you created a structure called adventurer, then the code: struct adventurer playerl playerl nitializeAdventurer): creates a new structure called player1 (first line) and sets the initial values (second line). The name of the structure and the function is up to you. Note that the initialization function can do things like ask the user for input (for example the player's name) or generate random numbers (for example for the player's statistics) Print Function: this function should take a structure as an argument and print it in some reasonable format. That is the code print playerl); should result in the details of the playerl structure being printed in a way that is clear to the user player The main part of the program should do several things Define your structure Create two variables of the type of your structure, for example create a playerl struct and a player2 struct. Initialize both structures Print both structures using the print function. o o oStep 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