List.cpp - List.cpp This program implements the mergeLists...

Info icon This preview shows pages 1–2. Sign up to view the full content.

/** * List.cpp - This program implements the mergeLists() helper function. * * Dr. Jack Davault * CS3330 Data Structures and Algorithms */ #include <iostream> #include <cstdio> #include <list> using namespace std; template <class Object> void printList(list<Object> list1); template <class Object> void mergeLists(list<Object>& merged, list<Object>& L1, list<Object>& L2); int main(int argc, char **argv) { // Declare list variables list<double> L1; list<double> L2; list<double> L3; list<double> merged; // Add data to the list L1 L1.push_back(80.5); L1.push_back(20.4); L1.push_back(53.8); L1.push_back(52.4); L1.push_back(81.7); // Print the contents of the list cout << "List (L1): " << endl; printList(L1); // Add data to the list L2 L2.push_back(45.2); L2.push_back(80.1); L2.push_back(87.6); L2.push_back(16.1); L2.push_back(25.6); // Print the contents of the list cout << "List (L2): " << endl; printList(L2); // Add data to the list L3 L3.push_back(61.1); L3.push_back(56.2); L3.push_back(69.8); L3.push_back(73.7); L3.push_back(51.9); // Print the contents of the list cout << "List (L3): " << endl; printList(L3);
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern