main.cpp

/* Programmer: Jennifer Leopold Date: October 8, 2015

File: hw7_main.cpp

Purpose: Program that builds a database of cars, and allows

user to query the database by license plate

number and car color.

To compile: fg++ hw7_main.cpp hw7_functs.cpp -o hw7

To execute: ./hw7

*/

#include <iostream>

#include <ctime>

#include <cstdlib>

#include "hw7_functs.h"

using namespace std;

int main()

{

carInfo cars[NUM_CARS]; // database of car registrations

char response; // 'Y' if user want to query database

// Greet user

cout << "Welcome to the Springfield Municipal Auto "

<< "Registration Database!\n\n";

// Seed the random number generator

//srand(time(NULL));

srand(10); // for grading

// Build the database of cars

cout << "Building the car database...\n";

buildCarDatabase(cars, NUM_CARS);

cout << "Car database built.\n\n";

printCarDatabase(cars);

// Allow the user to repeatedly query the database

do

{

response =

getYNInput("Do you want to query the car database (y/n)? ");

if (response == 'Y')

queryCarDatabase(cars, NUM_CARS);

} while (response == 'Y');

// Sign-off

cout << "\nHave a nice day!\n";

return 0;

}