/***************************************************************************
 * This program illustrates the use of header files and separate compilation
 * for function definitions.
 ***************************************************************************/
#include "show_and_mode.h"
#include <iostream>
#include <vector>
#include <stdexcept> //for exceptions
using std::cin;           
using std::cout;            
using std::endl;  using std::domain_error;          
using std::vector;	using std::sort;
typedef vector<int>::size_type vec_size;

void ten_zeros(vector<int>& vec)//You can declare and define at the beginning.
{
	vec.clear();
	for(vec_size i=0; i!=10; i++)
		vec.push_back(0);
	return;
}




	
int main()
{
	vector<int> v, w;
	int x;
	ten_zeros(v);
	v[3]=-5;
	try
	{
		x=mode_elt(v);
	}
	catch(domain_error e)
	{
		cout<<endl<<e.what();//e.what() is the string from the 'throw'.
	}
	cout<<"A mode value is "<<mode_elt(v)<<".\n";
	cout<<"The vector is \n";
	show_vec(v);
	try
	{
		mode_elt(w);
	}
	catch(domain_error e)
	{
		cout<<endl<<e.what();
	}
		w.push_back(77);
		cout<<"\nNow there's something there. ";
	try
	{
		int x=mode_elt(w);
		cout<<"The new mode is "<<x<<".\n";
	}
	catch(domain_error e)
	{
		cout<<endl<<e.what();
		
	}
       	return 0;
}


