Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ programming, Chapter 11: Structures In this lab you will work with processing an array of structs. First define a struct called BookInfo. It

Using C++ programming,

Chapter 11: Structures

In this lab you will work with processing an array of structs. First define a struct called BookInfo. It should have 2 fields - a string to hold the title of a book, and a double to hold the price. Next define a second struct called Author. It should have 2 fields a string to hold the name of the author, and an array of BookInfo (with 3 elements) to store the three books the author has written.

In main, declare an array of Author structures with 3 elements. This array should be initialized to set all the string fields (the names and the book titles) to NONE, and the double fields (the prices) to zero. Remember initialization means to declare and assign values to the array all in one statement ( i.e. no for loops, etc.).

Next call a function from main with the following prototype:

void showInfo(Author a[], int size);

This function should printout the content of the array on the screen Next call a function from main with the following prototype:

void getInfo(Author a[], int size);

This function should allow the user to enter values into the array. If the user types NONE for one of the book titles, this means that the author has less than 3 books. The user should not be prompted to enter any more titles and price info for books by that author.

Next, call the showInfo function again from main to display the users input on the screen.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago

Question

Different types of Grading?

Answered: 1 week ago

Question

Explain the functions of financial management.

Answered: 1 week ago