/* findmileage1.cpp computes the mileage between two cities.
 *
 * Input:        city1 and city2, two integers representing cities
 * Precondition: for n cities, city1 and city2 are in the range 0..n-1
 * Output:       the mileage between city1 and city2
 **********************************************************************/

#include <iostream.h>                     // cin, cout
#include <string>                         // string

int main()
{
   const int NUMBER_OF_CITIES = 6;
   const int MILEAGE_CHART[NUMBER_OF_CITIES][NUMBER_OF_CITIES] 
     = { {   0,  97,  90, 268, 262, 130 },     // Daytona Beach
         {  97,   0,  74, 337, 144, 128 },     // Gainesville
         {  90,  74,   0, 354, 174, 201 },     // Jacksonville
         { 268, 337, 354,   0, 475, 269 },     // Miami
         { 262, 144, 174, 475,   0, 238 },     // Tallahassee
         { 130, 128, 201, 269, 238,   0 } };   // Tampa

   const string CITY_MENU 
       = "To determine the mileage between two cities,\n"
         "please enter the numbers of 2 cities from this menu:\n\n"
         "    0 for Daytona Beach,   1 for Gainesville\n"
         "    2 for Jacksonville,    3 for Miami\n"
         "    4 for Tallahassee,     5 for Tampa\n\n"
         "--> ";

   cout << CITY_MENU;
   int city1, city2;
   cin >> city1 >> city2;

   int mileage = MILEAGE_CHART[city1][city2];

   cout << "\nThe mileage between those 2 cities is " 
        << mileage << " miles.\n";
}

