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...
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...
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...
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...
Program Task (C++) The program should contain an abstract data type (ADT) for an Employee, defined...
Program Task (C++) The program should contain an abstract data type (ADT) for an Employee, defined as follows: struct Employee int id; // unique employee identifier string name; // employee’s full name double rate; // employee’s hourly rate double hours; // how many hours they worked since last pay double taxable; // the current year’s taxable income }; This definition should appear above the main() function. The main() function should include: 1. Declare a single array to hold at most...
When I wrote this code in the Eclipse program, I did not see a output .....
When I wrote this code in the Eclipse program, I did not see a output .. Why? _______ public class AClass { private int u ; private int v ; public void print(){ } public void set ( int x , int y ) { } public AClass { } public AClass ( int x , int y ) { } } class BClass extends AClass { private int w ; public void print() { System.out.println (" u + v...
Need some assistance with a java program “Square,” that will implement a data type Square that...
Need some assistance with a java program “Square,” that will implement a data type Square that represents squares with the x and y coordinates of their upper-left corners and the length. The API should be as follows. Square(double x, double y, double length) //constructor double area() //returns the area of the square double perimeter() //returns the perimeter of the square boolean intersects(Square b) //does this square intersect b? Two squares would intersect if they share one or more common points...
Write a program that defines an animal data type, with an animal name, age, and category...
Write a program that defines an animal data type, with an animal name, age, and category (cat, dog, etc.), as well as an animal array type that stores an array of animal pointers. (ex. structType *arr[size];) Your program will prompt the user to enter the data for as many animals as they wish. It will initialize a dynamically allocated animal structure for each animal, and it will store each animal in an instance of the animal array structure. Your program...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT