October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Now that we’ve covered some of the main features of structures, it’s time to put the ideas together in a structure-using program. Listing 4.11 illustrates these points about a structure. Also it shows how to initialize one.
Listing 4.11. structur.cpp
// structur.cpp -- a simple structure#include <iostream>struct inflatable // structure declaration{ char name[20]; float volume; double price;};int main(){ using namespace std; inflatable guest = { "Glorious Gloria", // name value 1.88, // volume value 29.99 // price value }; // guest is a structure variable of type inflatable// It's initialized to the indicated values inflatable pal = { ...
Read now
Unlock full access