Create linked list class called DateList This should be a li

Create linked list class called DateList.

This should be a linked list with head node. Modify it so that the data type in the nodes is Date212. The no-argument constructor should create an empty list with first and last pointing to an empty head node, and length equal to zero.

Include two methods in class DateList: append and insert. The append method will add the new node to the end of the list; the insert method will add the node in the proper position to keep the list sorted in order by date.


Instantiate two linked lists, and for every date read from the file, add it to the first list using append, and to the second list using insert. You will end up with the first list having the dates from the input file in the order they were read, and in the second list the dates will be in sorted order.

Solution

#include #include #include #include #include using namespace std; const std::string currentTime() { time_t now = time(0); struct tm tstruct; char buf[80]; tstruct = *localtime(&now); strftime(buf, sizeof(buf), \"%H:%M:%S %P\", &tstruct); return buf; } const std::string currentDate() { time_t now = time(0); struct tm tstruct; char buf[80]; tstruct = *localtime(&now); strftime(buf, sizeof(buf), \"%B %A \", &tstruct); return buf; } int main() { cout << \"\\033[2J\\033[1;1H\"; std:cout << \"The current time is \" << currentTime() << std::endl; time_t t = time(0); // get time now struct tm * now = localtime( & t ); cout << \"The current date is \" << now->tm_mon + 1 << \'-\' << (now->tm_mday + 1) << \'-\' << (now->tm_year + 1900) << \" \" << currentDate() << endl; cout << \"Day of month is \" << (now->tm_mday) << \" and the Month of year is \" << (now->tm_mon)+1 << \",\" << endl; cout << \"also the day of year is \" << (now->tm_yday) << \" & our Weekday is \" << (now->tm_wday) << \".\" << endl; cout << \"The current year is \" << (now->tm_year)+1900 << \".\" << endl; return 0; }
Create linked list class called DateList. This should be a linked list with head node. Modify it so that the data type in the nodes is Date212. The no-argument

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site