Mylab Programming With Pearson Etext -- Access Code Card -- For C++ How To Program (early Objects Version)
bartleby

Videos

Question
Book Icon
Chapter 22, Problem 22.4E
Program Plan Intro

To Determine:

Definition for each of the following:

  1. Structure inventory, containing character array part name [30], integer part number, floating-point price, integer stock and integer reorder.
  2. A structure called address that contains character arrays street address [25], city [20], state [3] and zipcode [6].
  3. Structure student, containing arrays first name [15] and last name [15] and variable home address of type struct address from part (b).
  4. Structure test, containing 16 bit fields widths of 1 bit. The names of the bit fields are the letters a to p.

Expert Solution & Answer
Check Mark

Explanation of Solution

Explanation:

Defining Structures:

Structure is nothing but the collection of different variables of different types. First we need to define a structure in the program, for that we need to use the keyword struct and then the name of the structure. The name under which we want to combine different-different variables or different-different elements and between the curly braces whatever we write or whatever variables we declare will be considered as the members of the structure. All the members will be available under this one name of the structure. Declaring or defining the member of a structure is similar to the way we declare the variables.

  1. Here we are storing the information of Inventory, so the structure name will be Inventory and all the members are available under this one name Inventory.
  2. structInventory
    {
    	charpartName[30];
    	intpartNumber;
    	floatprice;
    	intstock;
    	intrecorder;
    };
  3. Here we are storing the information of Address, so the structure name will be Address and all the members are available under this one name Address.
  4. structAddress
    {
    	charstreetAddress[25];
    	charcity[20];
    	charstate[3];
    	charzipCode[6];	
    };
  5. Here we are storing the information of Student, so the structure name will be Student and all the members are available under this one name Student.
  6. structStudent
    {
    	charfirstName[15];
    	charlastName[15];
    	struct
    	{
    		charstreetAddress[25];
    		charcity[20];
    		charstate[3];
    		charzipCode[6];
    	}
    	homeAddress;
    };
  7. Here we are storing the information of Test, so the structure name will be Test and all the members are available under this one name Test.
  8. structTest
    {
    	boola:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1,
    	i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1;
    };

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Write C# statements to accomplish each of the following tasks: a. Display the value of the element of character array f with index 6. b. Initialize each of the five elements of one-dimensional integer array g to 8. c. Total the 100 elements of floating-point array c. d. Copy 11-element array a into the first portion of array b, which contains 34 elements. e. Determine and display the smallest and largest values contained in 99-element floating-point array w.
7. using c++, Write a void function that accepts an integer array a and a integer SizeA, and an integer n, and adds n to every element in that array. Be sure to develop an appropriate name for your function.
3234-Write a C++ program to input elements in array and sort array elements in  descending order. How to sort array in descending order in using pointers.Use function to print out the original and sorted arrays, Example Input Input size of array: 10  Input array elements: 20, 2, 10, 6, 52, 31, 0, 45, 79, 40  Output Array sorted in descending order:  79 ,52,45,40,31,20,10,6,2,0

Chapter 22 Solutions

Mylab Programming With Pearson Etext -- Access Code Card -- For C++ How To Program (early Objects Version)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License