#include <iostream>
#include <string>
using namespace std;
#include "list.h"

int main()
{
/*
    string h = "Hello,";
    string w = "world!";

    list<string> L;
    cout << "list from default constructor, list size is " << L.size() << endl;

    L.push_front(w);
    cout << "pushed world" << ", list size is " << L.size() << endl;
    L.push_front("hello,");
    cout << "pushed hello" << ", list size is " << L.size() << endl;
    list<string>::iterator p;

    // should print h then w.
    cout << " // should print h then w. " << endl;
    for ( p = L.begin(); p != L.end(); p++ ) cout << *p << " ";
    cout << endl;

    p = L.begin();
    L.erase(p);
    cout << "erased first item, list size is " << L.size() << endl;

    // should print w.
    cout << " // should print w. " << endl;
    for ( p = L.begin(); p != L.end(); p++ ) cout << *p << " ";
    cout << endl;

    L.push_back( "toys" );
    cout << " pushed word at back,  list size is " << L.size() << endl;
    L.insert( ++L.begin(), "of" );
    cout << " inserted word before last,  list size is " << L.size() << endl;
    
    // should print 3 words
    cout << " // should print 3 words" << endl;
    for ( p = L.begin(); p != L.end(); p++ ) cout << *p << " ";
    cout << endl;

    cout << "Try to dereference p after getting to end - should be error" << endl;

    *p;
*/

    // illustrate size and square bracket indexing trouble
    
    list<float> Nums;
    for (int i = 0; i < 1000; ++i) Nums.push_back(random());

/*
    float max = 0;
    for (list<float>::iterator p = Nums.begin(); p != Nums.end(); ++p)
	if (*p > max) 
	    max = *p; 
    cout << "The max is " << max << endl;
*/

    float max = 0;
    for (int i = 0; i < Nums.size(); ++i)
	if (Nums[i] > max) 
	    max = Nums[i]; 
    cout << "The max is " << max << endl;

    
}

