






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The document introduces the concept of structures in C++ programming. It explains how structures can be used to organize simple variables into more complex entities. examples of how to use structures to display structure members and place a person's information. useful for students learning C++ programming and want to understand how to use structures to organize data.
Typology: Slides
1 / 12
This page cannot be seen from the preview
Don't miss anything!







Structures
Program to use a structure (1/2) // uses parts inventory to demonstrate structures #include
Program to use a structure (2/2) // display structure members cout << "Model " << part1.modelnumber; cout << ", part " << part1.partnumber; cout << ", costs $" << part1.cost << endl; system("PAUSE"); return 0; }
Initializing Structure Members (1/2) // uses parts inventory to demonstrate structures #include
Placing A Person’s Information (1/3) #include
Placing A Person’s Information (2/3) int main(){ student sd1; cout << "Please Enter Your Information " << endl; cout << "Name: "; gets(sd1.name); cout << "mobile Number: "; gets(sd1.mobile); cout << "Your Age: "; cin >> sd1.age; cout << "Please Enter Your Birthday \n"; cout << "Year: "; cin >> sd1.birthday.year; cout << "month(1-12): "; cin >> sd1.birthday.month; cout << "Day(1-31): "; cin >> sd1.birthday.day;