Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I was given this code for guidance but it does not work it says that the rs are not being used I have tried to
I was given this code for guidance but it does not work it says that the rs are not being used I have tried to figure it out but it doesnt work. C++ MUST BE USED. Thank you
Details: You are tasked with (pseudo)-randomly assigning roles to a group of 5 players that are playing a sci-fi/fantasy game. Each player will be assigned one of four available roles. There is a possibility that some roles may be filled by more than one player and that some roles may be unused Implementation Each player is represented as a variable of the enumeration type role role player5; //sample declaration of variable player5 of type role Enum types will be discussed during lecture; see Savitch 119 120 for additional details. The constants for role are BITBARD BYTE BRAWLER, DATA MAGE TECH_KNIGHT You will define two (2) functions for this assignment: assignRoles) has five parameters of role enum type, one for each player. This function randomly assigns a role constant to each player. This is a void function; if it helps, one can say that it returns five values. getRoleName0 has one parameter of role enum type. This function outputs a string literal that represents that role. To illustrate, the constant DATA MAGE stored in the role parameter will be used to output the string literal "Data Mage". Here are the string-type role names for each role-type constant: BIT BARD -> "Bit Bard BYTE BRAWLER -> "Byte Brawler" DATA MAGE-> "Data Mage" TECH_KNIGHT-> "Tech Knight" You may use the selection statement(s) of your choice in this function (i.e. if/if-else, switch) main) must be used exclusively to: e declare five role variables call assignRoles0 once . call getRoleName0 five times . output results Results: You will output the roles assigned to each player in the following format: Player 1: [Role] Player 2: [Role] Player 3: [Role] Player 4: [Role] Player 5: [Role] Where [Role] is the randomly-assigned role for each player #include 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