89 128
Assignments Done
98.1%
Successfully Done
In July 2020

# Answer to Question #44119 in C++ for Steve

Question #44119
Provide the definition for each of the following structures:

a) Structure Inventory, containing array of characters partName[ 30 ], integer partNumber, and floating-point price.

b) A structure called Address that contains character arrays street[25], city[20], country[30].

c) Structure Student, containing arrays firstName[ 15 ] and lastName[ 15 ] and homeAddress of type Address ( part (b)).

Given the following structure:

struct book {

char title[50];

char auther[50];

float price;

};

book b1 = {&quot;introduction to fortran&quot;, &quot;ali hassan&quot;, 98.0};

book b2 = {&quot;introduction to lisp&quot;, &quot;ahmad hassan&quot;, 98.0};

book b3;

book *b;

If there is no errors, what will be the output produced by the following code segments? If there is errors, identify and fix

1) b3 = b1;

cout &lt;&lt; b3.title &lt;&lt; endl;

2) b3 = b2;

if (b3 == b2)

cout &lt;&lt; b3.title &lt;&lt; &quot; == &quot; &lt;&lt; b2.title &lt;&lt; endl;

else

cout &lt;&lt; b3.title &lt;&lt; &quot; != &quot; &lt;&lt; b2.title &lt;&lt; endl;

3) b = &amp;b1;

if ((*b).title == b1.title) {

cout &lt;&lt; &quot;It is the same book &quot; &lt;&lt; endl;

}

4) b = &amp;b2;

if (b-&gt;price == b1.price)

cout &lt;&lt; b-&gt;title &lt;&lt; &quot; has same price as &quot; &lt;&lt; b1.title;

else

cout &lt;&lt; b-&gt;title &lt;&lt; &quot; has different price as &quot; &lt;&lt; b1.title;

5) b3.title = b1.title;

cout &lt;&lt; &quot;b1 and b3 have the same title &quot; &lt;&lt; endl;

6) b = &amp;b2;

b -&gt; price = 100;

cout &lt;&lt; b1.price &lt;&lt; endl;

7) b = &amp;b2;

if (strcmp(b1.author, b-&gt;author) )

cout &lt;&lt; &quot;b1 and b2 having the same author &quot; &lt;&lt; endl;

8) if (b1.price &gt; b2.price)

cout &lt;&lt; b1.title;

else

cout &lt;&lt; b2.title;

9) Write a code segment that prompt the user to enter the number of books to be entered from keyboard.

10) Dynamically declare an array of books with size as entered by the user in 8

11) Read in and fill the array of books

12) Write a function that takes the array of books and return through parameters the book that has lowest price and the

book that has the highest price

13) Write a function that takes the array of books and reduces the price of each book by 10%.

14) Write a function that takes one parameter author name and displays all books that he wrote and their prices.
0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!