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

This note was uploaded on 05/03/2011 for the course CSCI 180 taught by Professor Goldwasser,m during the Fall '08 term at Saint Louis.

Ask a homework question - tutors are online