testList - mylist.draw"list"&it true...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "List.h" #include <iostream> using namespace std; int main() { List<int> mylist; // create a list //add a few elements and keep drawing it mylist.draw("list", 0, true); mylist.push_back(5); mylist.draw("list", 0, true); mylist.push_back(10); mylist.draw("list", 0, true); mylist.push_back(100); mylist.draw("list", 0, true); mylist.push_front(11); mylist.draw("list", 0, true); mylist.pop_back(); mylist.draw("list", 0, true); List<int>::iterator it = mylist.begin();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mylist.draw("list", &it, true); mylist.insert(it, 7); mylist.draw("list", &it, true); it = mylist.end(); mylist.insert(it, 12); mylist.draw("list", &it, true); //test the iterator code //Note: we need the begin and end functions for this one! // List<int>::iterator iter = mylist.begin(); // mylist.draw("list", &iter, true); // while (iter != mylist.end()) { // ++iter; // mylist.draw("list", &iter, true); // } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online