Question: Hi, I would like to see if my C++ program follows all the steps. Thanks Code: #include using std::cout; using std::endl; //struct definition struct tod
Hi, I would like to see if my C++ program follows all the steps. Thanks



Code:
#include
//struct definition struct tod { int h; //the hour, 0-23 int m; //the minute, 0-59 int s; //the second, 0-59 char d[32]; //the description of the time of day tod* next; //link };
//function prototype(s) void coutTod(const tod*);
int main() {
tod noon = {12,0,0,"noon"}; tod midnight = {0,0,0,"midnight"}; tod lunchtime = {13,0,0,"lunch time"}; tod suppertime = {18,40,0,"supper time"}; tod bedtime = {22,30,0,"bed time"};
//create a linked list tod* start = 0; start = &midnight; midnight.next = &noon; noon.next = &lunchtime; lunchtime.next = &suppertime; suppertime.next = &bedtime; bedtime.next = 0;
tod* p; for (p=start; p; p=p->next) { coutTod(p); }
//step 2.1 cout next) { coutTod(p); }
//step 2.2 cout next) { coutTod(p); }
//step 2.3 cout next) { coutTod(p); }
//step 2.4 cout next) { coutTod(p); }
//step 2.5 cout
cout next) { coutTod(p); }
}
void coutTod(const tod* t) { cout d h m m s s LAB 11: Introduction To Linked Lists [ sLList.cpp] Create a console application named sLList. Do NOT submit until you complete the last step STEP 1 of 2: A Simple Linked List Create a project named sLList.cpp, containing 5 objects of a modified tod structure, creates a linked list with them, and prints them in chronological order. Borrow the coutTod) function from Lab 8 or Lab 9b, in order to print the object. If you elected to do the "optional bonus step" in Lab 8, you may use the "member function" version of this function, if you wish to do so. Use the following modified structure definition, which includes abbreviated names for hour, minute, and second struct tod int hi 1/ hour, 0-23 int m; // minute, 0-59 int si // second, 0-59 char dl32]; // description tod* next; // link li Declare and initialize 5 objects of the above structure in main), but do not do so in an array -- create separate objects, including these two tod noon = {12, 0, tod midnight-(0, 0, 0, "noon"); 0, "midnight"); The three additional objects should be for lunchtime, suppertime, and bedtime, initialized to values of your choosing. Create a start pointer in main0, as an object of tod". Initialize it to the memory address of midnight. This starts the list with the midnight object. E.g
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
