Programming in C++ Dale/Weems/Headington Chapter 14 Records ( C++ Structs )

9/20/99


Click here to start


Table of Contents

Programming in C++ Dale/Weems/Headington Chapter 14 Records ( C++ Structs )

PPT Slide

Limitation of array type

thisAnimal

anotherAnimal

struct AnimalType

struct type declaration

struct type declaration

More about struct type declarations

Accessing struct members

Valid operations on a struct member depend only on its type

Aggregate struct operations

Examples of aggregate struct operations

PPT Slide

PPT Slide

PPT Slide

Array of structures

AnimalType bronxZoo[MAX_SIZE] ;

AnimalType bronxZoo[MAX_SIZE] ;

Add 1 to the age member of each element of the bronxZoo array

Write id and genus for each element of bronxZoo array from country “China”

Find total weight of all elements of the bronxZoo array

Hierarchical structures

struct MachineRec

PPT Slide

struct type variable machine

Unions in C++

Using Unions

Author: Sylvia Sorkin

Email: ssorkin@essex.cc.md.us

Home Page: http://www.essex.cc.md.us/Essex/People/ssorkin/index.html

Download presentation source