Question: write a c + + code that The Animal structure is the same as from the 1 0 . 1 assignment so you may copy

write a c++ code that The Animal structure is the same as from the 10.1 assignment so you may copy/paste it into this program...
Define a structure named Animal with the following four fields:
species (string): Represents the species of the animal.
age (int): Represents the age of the animal.
weight (double): Represents the weight of the animal.
isPet (bool): Represents whether the animal can be a pet (true) or not (false).
The code to read in the Animal data is very similar to the previous project but this time you will read in 4 Animal objects into your array.
Within the main function declare an array of 4 Animal objects called myAnimals.
Write a loop for each element of the array to prompt the user for input values for each of the fields as follows:
What is the species of animal ?
What is the age of animal ?
What is the weight of animal ?
Can animal be a pet (y for yes, n for no)?
Important note: Add this code after you read the pet response every time in the loop:
cin.ignore(255,'
');
Write a function called youngPets that meets the following requirements...
It returns void
It takes two input parameters as follows...
Parameter 1 is an array of Animal objects
Parameter 2 is an integer representing the size of the array
The function prints the species of all animals that are pets and are younger than 3. The output will be printed as follows...
The pets younger than three are:
etc.
In main, call the youngPets function that will print out all of the young pets!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!