//
//
//  analyze.cc
//
//      AUTHOR: Russell Lowke
//         T.F: Francis Crick
//  CSCIE-s111: Unit Four, Easy Supp - question 3 [worth 2pts],  7/10/2002
//
//

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>


//
// random seed according to time
//
void randomizer()
{
	time_t      timeval;
	
	time(&timeval);
	srand(timeval);
}


//
// Random generator
//
int randomInt(int min, int max)
{
	static bool seed = false;
	int range = (max+1) - min;
	    
	if (! seed) {
		randomizer();
		seed = true;
	}
	
    return (int) (( rand() / (double) RAND_MAX ) * range + min);
}


//
// generate License
//
void makeLicense ()
{
   for (int i = 1; i <= 3; i++)	{		// generate License Numbers
   
       if (i == 1)
           cout << randomInt(1, 9);
       else
           cout << randomInt(0, 9);
   }
   
   cout << ' ';							// add a space
   
   for (int i = 1; i <= 3; i++) { 		// generate License Letters
       cout << (char) randomInt( (int) 'A', (int) 'Z');
	}
}


void main()
{
	for (int count = 1; count <= 20; count++) {
        cout << "License Plate " << count << ": ";
        makeLicense();
        cout << endl;
    }
    
	exit( 0 );
}