Question: Section 4 - Structured Data Refer to the following block of code when answering the questions in this section. struct Pet { string name; int

 Section 4 - Structured Data Refer to the following block ofcode when answering the questions in this section. struct Pet { string

Section 4 - Structured Data Refer to the following block of code when answering the questions in this section. struct Pet { string name; int age; }; 9) Create an enumerated variable named PetType that has values for a cat, dog and bird. Be sure to use the correct capitalization! 10) Create an array of pets. using the Pet structure. In the declaration of the array, initialize the elements to the following pet names and ages: Fluffy. 2 Dakota, 7 George, 5 11) Write a while loop that prints out all of the pet names and ages, one pet per line. 12) Redene the Pet structure to include a pet type using the enumerated variable from question #9. Section 5 - File Operations Refer to the following block of code when answering the questions in this section. int num1 = 87; char *dataPtr = nullptr; ifstream nameFile; string nameList = "friends. txt"; Page: 2 of 3 CISP360 Structured Programming with C++ 13) What code would need to be added, in place of ** 1 ** below, in order for num1 to be written to the file as a number instead of a character? file. write (** 1 **) ; 14) Initialize nameFile to the file in nameList. Write the loop needed to search the file and print out any name that is less than "G". Create any other variables needed

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 Programming Questions!