C++   How to Program (Early Objects Version)
C++ How to Program (Early Objects Version)
10th Edition
ISBN: 9780134448824
Author: Paul Deitel; Harvey M. Deitel
Publisher: Pearson Education (US)
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
A manipulator is identified by the following table of parameters and variables:a. Obtain the transformation matrices between adjacent coordinate frames and calculate the global transformation matrix.
Which tool takes the 2 provided input datasets and produces the following output dataset? Input 1: Record First Last Output: 1 Enzo Cordova Record 2 Maggie Freelund Input 2: Record Frist Last MI ? First 1 Enzo Last MI Cordova [Null] 2 Maggie Freelund [Null] 3 Jason Wayans T. 4 Ruby Landry [Null] 1 Jason Wayans T. 5 Devonn Unger [Null] 2 Ruby Landry [Null] 6 Bradley Freelund [Null] 3 Devonn Unger [Null] 4 Bradley Freelund [Null] OA. Append Fields O B. Union OC. Join OD. Find Replace Clear selection
What are the similarities and differences between massively parallel processing systems and grid computing. with references

Chapter 22 Solutions

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
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
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