Question: 200_assign13.cpp #include #include #include // list class-template definition using namespace std; int main() { list int_list; list char_list; list bool_list; int x = 0; for

 200_assign13.cpp #include #include #include // list class-template definition using namespace std;

200_assign13.cpp

#include

#include

#include // list class-template definition

using namespace std;

int main()

{

list int_list;

list char_list;

list bool_list;

int x = 0;

for (int i = 75; i >= 65; --i)

{

int_list.push_back(i);

char_list.push_back(static_cast (i + x));

if (i

x += 2;

} // end for

bool_list.push_back(true);

bool_list.push_back(false);

bool_list.push_back(false);

bool_list.push_back(true);

printlist(int_list);

cout

palindrome ";

printlist(char_list);

cout

palindrome ";

printlist(bool_list);

cout

palindrome ";

system("PAUSE");

return 0;

} // end main

NOTE: For this assignment you are not actually implementing any classes of your own. Instead, the focus of this assignment is on using the built-in list container from the STL library, and on using iterators to process and traverse the list. You will be using templates again for this assignment. The list container from the STL library is implemented as a doubly linked list, where each node in the list has both a previous pointer (prev) that points to the previous node in the list, and a next pointer that points to the next node in the list. Because of this, list objects can be traversed in both directions Write a templated function named palindrome that takes a 1ist parameter and returns true or false according to whether the list does or does not read the same forward as backward (e.g., a list containing 1, 2, 3, 2, 1 is a palindrome, but a list containing 1, 2, 3 4 is not). Note that because the function is templated, only ONE palindrome function is needed to support any type (e.g., int, char, string, bool, double, etc). This function should use terators to process and traverse the list. Write a templated function named printlist that takes a list parameter and prints out the contents of the list. Note that because the function is templated, only ONE printlist function is needed to support any type (e.g., int, char, string, bool, double, etc.). This function should use an iterator to process and traverse the list. Sample run (using the 200 assign13.c rogram 75 74 73 72 71 70 69 68 67 66 65 is not a palindrome KJIHGFGHI J K is a palindrome 1 00 1 e Press any key to continue is a palindrom

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!