// Example of using struct to create an ad hoc data structure -- months #include using namespace std; const int MONTHS = 12; const struct{char name[4]; int days; }months[MONTHS] = { {"Jan", 31}, {"Feb", 28}, {"Mar", 31}, {"Apr", 30}, {"May", 31}, {"Jun", 30}, {"Jul", 31}, {"Aug", 31}, {"Sep", 30}, {"Oct", 30}, {"Nov", 30}, {"Dec", 31} }; int main() { for(int i = 0; i< MONTHS; i++) { cout << i << ": "<< (i<10?" ":"") << months[i].name <<" has " << months[i].days << " days.\n"; } return 0; }