CISC 1600 Lecture Notes - Lecture 23: Unit Price, Semicolon, Savings Account

102 views4 pages

Document Summary

Structure does not define any variables, it simply gives an outline of how things are organized/look. struct course { //name of structure/ tag string discipline; coursetitle; int coursenumber; short credits; }; // same type can be in comma-separated list: Defining variable put the tag then the name of variable you want to call. course pchem; course colonialhist; structure, ie each of them will has 4 members like discipline, coursenumber,cousetitle, and credits. // both pchem and colonialhist will have the same. Nested structures a structure within another structure as a member: struct personinfo string name, address, city; struct student int studentid; Use the dot (. ) operator to refer to members of struct variables: variable name. tag cin >> stu1. studentid; getline(cin, stu1. name); if (a. studentid == b. studentid) cout << bill. yearinschool; Student s; s. pdata. name = joanne; s. pdata. city = tulsa; Initialize structure: cannot skip members of a structure during the initialization process unless all are left uninitialized.

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