C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
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
What should the next three steps be in my machine based home security system after deployment and after the following current steps: Enhancing Security & Privacy Measures User Interface (UI) and Experience (UX) Improvement  Machine Learning Model Refinement & Continuous Improvement
I am creating a machine learning home based security system, have completed initial deployment and in the following phases of the project: Expanding device compatibility and integration, preparing for cloud integration, and implementing system reduncancy and disaster recovery. What should the next three phases be?
Hands-On Assignments Part II Assignment 1-5: Querying the DoGood Donor Database Review the DoGood Donor data by writing and running SQL statements to perform the following tasks: 1. List each donor who has made a pledge and indicated a single lump sum payment. Include first name, last name, pledge date, and pledge amount. 2. List each donor who has made a pledge and indicated monthly payments over one year. Include first name, last name, pledge date, and pledge amount. Also, display the monthly payment amount. (Equal monthly payments are made for all pledges paid in monthly payments.) 3. Display an unduplicated list of projects (ID and name) that have pledges committed. Don't display all projects defined; list only those that have pledges assigned. 4. Display the number of pledges made by each donor. Include the donor ID, first name, last name, and number of pledges. 5. Display all pledges made before March 8, 2012. Include all column data from the DD PLEDGE table.

Chapter 22 Solutions

C++ How to Program (10th Edition)

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