//==============================================================================
// 215 Spring 2006
// Lab #3
// Recursive functions on STL Lists
// Starter File
//

#include <list>
#include <iostream>

using namespace std;


//==============================================================================
// PROTOTYPES

list<char> GetInput();
void PrintList( list<char> thelist );


//==============================================================================
// MAIN

int main()
{
	int choice;                // menu choice
	list<char> input;          // list to operate choice on
	list<char> result_list;    // list returned as a result
	char arg;                  // argument to search for / delete / whatever from list

	do
	{
		// MENU ------------------------------------------------------------------

		cout << endl << endl;
		cout << "MENU:" << endl;
		cout << "1) last_of() " << endl;
		cout << "2) remove() " << endl;
		cout << "3) position()" << endl;
		cout << "4) compress()" << endl;
		cout << "5) membership() " << endl;
		cout << "6) nonmembership() " << endl;
		cout << "7) nodoubles() " << endl;
		cout << "8) QUIT " << endl;

		cin >> choice;

		if ( choice != 8 )
			input = GetInput();

		// PROCESSING CHOICE -----------------------------------------------------

		switch ( choice )
		{

		case 1 : // last_of()

			break;

		case 2 : // remove()

			break;

		case 3 : // position()

			break;

		case 4 : // compress()

			break;

		case 5 : // membership()

			break;

		case 6 : // nonmembership()

			break;

		case 7 : // nodoubles()

			break;


		} // end switch

	} while ( choice != 8 );

	return 0;

} // end main




//==============================================================================
// GetInput
//
// PRE:
// POST: Prompts user for a sequence of characters separated by a single character
//       (can be any character) and terminated with a return.  Inserts this
//       sequence into a list and returns that list.

list<char> GetInput()
{
	list<char> newlist;
	char c;

	cin.ignore();
	cout << "Enter characters, ending with return: ";

	do
	{
		cin.get( c );
		newlist.push_back( c );
	
		cin.get( c );   // eat separator

	} while ( c != '\n' );

	return newlist;

} // end GetInput





//==============================================================================
// PrintList
//
// PRE:  'thelist' is a list of characters.
// POST: Prints 'thelist' to the screen, separating the characters by spaces,
//       ending with a newline.

void PrintList( list<char> thelist )
{
	list<char>::iterator i;

	for ( i=thelist.begin(); i!=thelist.end(); i++ )
		cout << *i << " ";

	cout << endl;

} // end PrintList