Question

In: Computer Science

Description: In this program, you'll reuse the Monster data type you wrote in LA11A. Then, you'll...

Description:

In this program, you'll reuse the Monster data type you wrote in LA11A. Then, you'll write a function that accepts a Monster as an argument by reference, then print the Monster to the screen.

Again, this will be structured as a guided multiple choice quiz where you will choose the appropriate code for a program. After you have gotten a perfect score, write out the program and compile and run it to see it in action.

Instructions:

Choose the correct C++ code for each requirement presented.

Sample Run:

Monster name: Kobold
Monster movement: 2
Monster dps: 1.25

Solutions

Expert Solution

#include <iostream>
using namespace std;
struct Monster{
        string name;
        int movement;
        double dps;
};
void printData(Monster &m){
        cout<<"Monster name: "<<m.name<<endl;
        cout<<"Monster movement: "<<m.movement<<endl;
        cout<<"Monster dps: "<<m.dps<<endl;
}
int main(){
        Monster m ={"kobold",2,1.25};
        printData(m);
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME


Related Solutions

In this program, you'll create a program that utilizes an enumerated data type to manipulate the...
In this program, you'll create a program that utilizes an enumerated data type to manipulate the array.   Here are the requirements: Write a program that contains an enumerated data type named Letters.    In the declaration, include the following three enumerators: ALPHA, BETA, DELTA. Then, create an array of integers three elements long. The array should be initialized to 0 using a 1-element initialization list. Instead of using integers as subscripts, use the enumerators from your enumerated data type to assign...
Challenge: Number Stats 2 Description: Extend the program you wrote for Number Stats to determine the...
Challenge: Number Stats 2 Description: Extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. Purpose: The purpose of this challenge is to provide experience working with numerical data in a file and generating summary information including the determination of median and mode. It also provides experience adding new functionality to an existing program. Requirements: Extend the program you wrote for Number Stats to determine the median and mode...
Exercise: Add Monster Cast Member ------------------------- ### Description In this series of exercises, you will create...
Exercise: Add Monster Cast Member ------------------------- ### Description In this series of exercises, you will create functions to create, modify and examine dictionaries that represent characters in an animated film, and the cast members who voice the characters. The keys of the dictionary will be character names. The values in the dictionary will be voice actor names. For this exercise, you will create a function that adds an entry to a dictionary. They key is a character name, and the...
What are the key factors to be considered with the most appropriate type of reuse? Which...
What are the key factors to be considered with the most appropriate type of reuse? Which features are supported by most of the web application frameworks? What are some essential elements of component based software engineering?
C++ only Large Program Create a magical creature (or monster) zoo inventory program that will allow...
C++ only Large Program Create a magical creature (or monster) zoo inventory program that will allow a zookeeper to add magical creatures (either manually or from a file), delete a creature, and display all creatures in the zoo. The zoo creatures will be organized in a linked list. ---------------------------------------------------------------------------- Zoo.cpp – this file will contain your main function that will allow the user to enter, delete, and print creatures. The main function will create the linked list of creatures. Creature.h...
Create a program named CmdLineCalc.java that works like a simple calculator. You'll run this program from...
Create a program named CmdLineCalc.java that works like a simple calculator. You'll run this program from the command line: $ java CmdLineCalc 1 + 2 3.0 $ java CmdLineCalc 1 - 2.5 -1.5 $ java CmdLineCalc 3 + 4 - 5 2.0 $ java CmdLineCalc 6.5 - 7 + 8 7.5 To keep it simple, your program only needs to support addition (+) and subtraction (-). You may assume that, starting with the first argument, every other argument will be...
Previously, you wrote a program named Admission for a college admissions office in which the user...
Previously, you wrote a program named Admission for a college admissions office in which the user enters a numeric high school grade point average and an admission test score. The program displays Accept or Reject based on those values. Now, create a modified program named AdmissionModularized in which the grade point average and test score are passed to a method that returns a string containing Accept or Reject. CODE: using System; using static System.Console; class Admission {    static void Main()...
Discuss how you would determine a data type for your program variables. Give an example of...
Discuss how you would determine a data type for your program variables. Give an example of each data type declaration in your program.
Program this in C thank you PROBLEM DESCRIPTION: Write a program to implement the following requirement:...
Program this in C thank you PROBLEM DESCRIPTION: Write a program to implement the following requirement: The program will read from standard input two things - a string str1 on the first line of stdin (this string may be an empty string) - a string str2 on the second line of stdin (this string may be an empty string) Note that stdin does not end with '\n'. The program will output a string that is the concatenation of string str1...
I wrote this program to check a string is palindrome or not. but in both cases,...
I wrote this program to check a string is palindrome or not. but in both cases, it gives me palindrome. could someone help me with this program? it has an error I couldn't find. when I run the code and give a string, in both cases it gives me palindrome. for example if I give Pop it says it is a palindrome but if I give Salima, it also says palindrome. #include<string> #include <iostream> using namespace std; class PString:public string...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT