🗊 Презентация Records C++ Structs

Нажмите для полного просмотра!
Records C++ Structs, слайд №1 Records C++ Structs, слайд №2 Records C++ Structs, слайд №3 Records C++ Structs, слайд №4 Records C++ Structs, слайд №5 Records C++ Structs, слайд №6 Records C++ Structs, слайд №7 Records C++ Structs, слайд №8 Records C++ Structs, слайд №9 Records C++ Structs, слайд №10 Records C++ Structs, слайд №11 Records C++ Structs, слайд №12 Records C++ Structs, слайд №13 Records C++ Structs, слайд №14 Records C++ Structs, слайд №15 Records C++ Structs, слайд №16 Records C++ Structs, слайд №17 Records C++ Structs, слайд №18 Records C++ Structs, слайд №19 Records C++ Structs, слайд №20

Вы можете ознакомиться и скачать презентацию на тему Records C++ Structs. Доклад-сообщение содержит 20 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


Records C++ Structs Chapter 14
Описание слайда:
Records C++ Structs Chapter 14

Слайд 2


What to do with records? Declaring records Accessing records Accessing the field of a record What is a union? Can records be in arrays?
Описание слайда:
What to do with records? Declaring records Accessing records Accessing the field of a record What is a union? Can records be in arrays?

Слайд 3


Records Recall that elements of arrays must all be of the same type In some situations, we wish to group elements of different types
Описание слайда:
Records Recall that elements of arrays must all be of the same type In some situations, we wish to group elements of different types

Слайд 4


Records RECORDS are used to group related components of different types Components of the record are called fields In C++ record called a struct...
Описание слайда:
Records RECORDS are used to group related components of different types Components of the record are called fields In C++ record called a struct (structure) fields called members

Слайд 5


Records C++ struct structured data type fixed number of components elements accessed by name, not by index components may be of different types
Описание слайда:
Records C++ struct structured data type fixed number of components elements accessed by name, not by index components may be of different types

Слайд 6


Declaring struct Variables Given Declare :
Описание слайда:
Declaring struct Variables Given Declare :

Слайд 7


Accessing Components Use the name of the record the name of the member separated by a dot . The dot is called the member selector
Описание слайда:
Accessing Components Use the name of the record the name of the member separated by a dot . The dot is called the member selector

Слайд 8


Aggregate Operations with Structures Recall that arrays had none (except reference parameter) Structures DO have aggregate operators assignment...
Описание слайда:
Aggregate Operations with Structures Recall that arrays had none (except reference parameter) Structures DO have aggregate operators assignment statement = parameter (value or reference) return a structure as a function type

Слайд 9


Aggregate Operations with Structures Limitations on aggregate operations no I/O no arithmetic operations no comparisons
Описание слайда:
Aggregate Operations with Structures Limitations on aggregate operations no I/O no arithmetic operations no comparisons

Слайд 10


Aggregate Operations with Structures struct variables must be compared member-wise. To compare the values of student and newStudent, you must compare...
Описание слайда:
Aggregate Operations with Structures struct variables must be compared member-wise. To compare the values of student and newStudent, you must compare them member-wise, as follows: if(student.firstName == newStudent.firstName && student.lastName == newStudent.lastName) ...

Слайд 11


Input/Output There are no aggregate input/output operations on struct. Data in a struct variable must be read one member at a time. Contents of a...
Описание слайда:
Input/Output There are no aggregate input/output operations on struct. Data in a struct variable must be read one member at a time. Contents of a struct must be written one member at a time.

Слайд 12


struct Variables and Functions A struct variable can be passed as a parameter either by value or by reference. A function can return a value of the...
Описание слайда:
struct Variables and Functions A struct variable can be passed as a parameter either by value or by reference. A function can return a value of the type struct Note example program fragment

Слайд 13


Arrays of Records First declare a struct (such as part_struct) Then specify an array of that type Access elements of the array, elements of the struct
Описание слайда:
Arrays of Records First declare a struct (such as part_struct) Then specify an array of that type Access elements of the array, elements of the struct

Слайд 14


Records with Arrays Example const int arraySize = 1000; struct listType { int elements[arraySize]; //array containing the list int listLength;...
Описание слайда:
Records with Arrays Example const int arraySize = 1000; struct listType { int elements[arraySize]; //array containing the list int listLength; //length of the list }

Слайд 15


Hierarchical Records records where at least one of the components is, itself, a record Example:
Описание слайда:
Hierarchical Records records where at least one of the components is, itself, a record Example:

Слайд 16


Choosing Data Structures Strive to group logical elements of a structure together calls for hierarchical structures Push details of entities down to...
Описание слайда:
Choosing Data Structures Strive to group logical elements of a structure together calls for hierarchical structures Push details of entities down to lower levels of the structure Data Abstraction separation of logical peoperties of a data type from its implementation

Слайд 17


Testing and Debugging Hints Declaration of a struct type must end with a semicolon ; Be sure to specify the full member selector when referencing a...
Описание слайда:
Testing and Debugging Hints Declaration of a struct type must end with a semicolon ; Be sure to specify the full member selector when referencing a component of a struct variable don’t leave out the struct name

Слайд 18


Testing and Debugging When using an array in a struct, the index goes at the end student_rec.scores[x] When using an array of struct, the index goes...
Описание слайда:
Testing and Debugging When using an array in a struct, the index goes at the end student_rec.scores[x] When using an array of struct, the index goes after the struct name parts_list[x].qty

Слайд 19


Testing and Debugging Process struct members separately … the only aggregate operations will be Assignment = Parameter passing void do_it...
Описание слайда:
Testing and Debugging Process struct members separately … the only aggregate operations will be Assignment = Parameter passing void do_it (part_struct part); Function return part_struct blanked_part ( );

Слайд 20


Testing and Debugging Be careful using same member names in different struct types Compiler keeps them separate OK Human readers can easily confuse...
Описание слайда:
Testing and Debugging Be careful using same member names in different struct types Compiler keeps them separate OK Human readers can easily confuse them



Теги Records Structs
Похожие презентации
Mypresentation.ru
Загрузить презентацию