MIS 24053 Lecture Notes - Lecture 21: Address Book, Array Data Structure

13 views6 pages

Document Summary

A structure is a collection of related data items, possibly of different types. A structure type in c++ is called struct. A struct is heterogeneous in that it can be composed of data of different types. In contrast, array is homogeneous since it can contain only data of the same type. Student record: student id, name, major, gender, start. Bank account: account number, name, currency, balance, year, . Individual components of a struct type are called members (or fields). Members can be of different types (simple, array or struct). A struct is named as a whole while individual members are named using field identifiers. Complex data structures can be formed by defining arrays of structs. struct basics. Example: struct date { int day; int month; int year; struct examples. Example: struct studentinfo{ int id; int age; char gender; double cga; Example: struct studentgrade{ char name[15]; char course[9]; int lab[5]; int homework[3]; int exam[2]; struct examples.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents