1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
#include <algorithm>
#include <cctype>
#include <iostream>
#include <map>
#include <stdexcept>
#include <string>
using namespace std;
int get_OU(std::string in)
{
static const std::map<std::string, int> OU
{
{ "wsl", 101 }, { "ucb", 102 }, { "ucs", 103 }, { "wls", 104 }, { "hbs", 105 }, { "reg", 106 }, { "rsg", 107 },
{ "tmg", 108 }, { "tmo", 109 }, { "tms", 110 }, { "wcg", 111 }, { "wdg", 112 }, { "whr", 113 }, { "wis", 114 },
{ "wsg", 115 },
};
std::transform(in.begin(), in.end(), in.begin(), ::tolower);
{
auto it = OU.find(in);
if (it != OU.end())
return it->second;
}
if (all_of(in.begin(), in.end(), ::isdigit))
return std::stoi(in);
throw std::invalid_argument("Bad OU string");
}
int get_area(std::string in)
{
static const std::map<std::string, int> area
{
{ "denver", 1 }, { "midland", 1 }, { "houston", 1 }, { "dallas", 2 }, { "birmingham", 3 }, { "huntsville", 3 },
{ "montgomery", 3 }, { "atlanta", 3 }, { "cedar rapids", 4 }, { "davenport", 4 }, { "des moines", 4 }, { "chicago", 4 },
{ "peoria", 4 }, { "indianapolis", 4 }, { "birmingham", 4 }, { "grand rapids", 4 }, { "saint louis", 4 },
{ "appleton", 4 }, { "green bay", 4 }, { "madison", 4 }, { "milwaukee", 4 }, { "wausau", 4 },
{ "wilmington", 5 }, { "center valley", 5 }, { "conshohocken", 5 }, { "devon", 5 }, { "harrisburg", 5 },
{ "kingston", 5 }, { "lancaster", 5 }, { "media", 5 }, { "philadelphia", 5 }, { "pittsburgh", 5 },
{ "plymouth meeting", 5 }, { "reading", 5 }, { "york", 5 }, { "boca raton", 6 }, { "clearwater", 6 },
{ "deerfield beach", 6 }, { "fort lauderdale", 6 }, { "jacksonville", 6 }, { "miami", 6 }, { "naples", 6 },
{ "orlando", 6 }, { "pensacola", 6 }, { "saint petersburg", 6 }, { "sarasota", 6 }, { "tampa", 6 },
{ "west palm beach", 6 }, { "nashville", 6 }, { "louisville", 6 }, { "washington, dc", 7 },
{ "baltimore", 7 }, { "bethesda", 7 }, { "mclean", 7 }, { "norfolk", 7 }, { "richmond", 7 },
{ "roanoke", 7 }, { "fredericksburg", 7 }, { "charleston", 7 }, { "asheville", 8 }, { "chapel hill", 8 },
{ "charlotte", 8 }, { "greensboro", 8 }, { "hickory", 8 }, { "lexington", 8 }, { "raleigh", 8 },
{ "winston salem", 8 }, { "charleston", 8 }, { "columbia", 8 }, { "greenville", 8 }, { "rock hill", 8 },
{ "hartford", 9 }, { "new haven", 9 }, { "shelton", 9 }, { "boston", 9 }, { "springfield", 9 },
{ "basking ridge", 9 }, { "haddon township", 9 }, { "moorestown", 9 }, { "red bank", 9 }, { "summit", 9 },
{ "toms river", 9 }, { "princeton", 9 }, { "albany", 9 }, { "amherst", 9 }, { "melville", 9 },
{ "new york", 9 }, { "white plains", 9 }, { "akron", 9 }, { "cincinnati", 9 }, { "cleveland", 9 },
{ "columbus", 9 }, { "miamisburg", 9 }, { "glendale", 10 }, { "phoenix", 10 }, { "scottsdale", 10 },
{ "tucson", 10 }, { "northglenn", 10 }, { "albuquerque", 10 }, { "salt lake city", 10 }, { "sandy", 10 },
{ "chico", 11 }, { "fresno", 11 }, { "modesto", 11 }, { "monterey", 11 }, { "oakland", 11 }, { "palo alto", 11 },
{ "sacramento", 11 }, { "san francisco", 11 }, { "san jose", 11 }, { "santa rosa", 11 }, { "stockton", 11 },
{ "walnut creek", 11 }, { "bakersfield", 12 }, { "camarillo", 12 }, { "el monte", 12 }, { "long beach", 12 },
{ "los angeles", 12 }, { "oxnard", 12 }, { "pasadena", 12 }, { "san luis obispo", 12 }, { "visalia", 12 },
{ "brawley", 13 }, { "carlsbad", 13 }, { "irvine", 13 }, { "ontario", 13 }, { "orange", 13 }, { "palm desert", 13 },
{ "san diego", 13 }, { "west covina", 13 }, { "las vegas", 13 }, { "reno", 13 }, { "boise", 14 },
{ "coeur d alene", 14 }, { "idaho falls", 14 }, { "butte", 14 }, { "helena", 14 }, { "bend", 14 }, { "eugene", 14 },
{ "medford", 14 }, { "portland", 14 }, { "bellevue", 14 }, { "bellingham", 14 }, { "seattle", 14 }, { "spokane", 14 },
{ "tacoma", 14 }, { "yakima", 14 }, { "sioux city", 15 }, { "bloomington", 15 }, { "minneapolis", 15 },
{ "saint paul", 15 }, { "fargo", 15 }, { "lincoln", 15 }, { "omaha", 15 }, { "sioux falls", 15 },
{ "overland park", 16 }, { "oklahoma city", 16 }, { "addison", 16 }, { "amarillo", 16 }, { "fort worth", 16 },
{ "plano", 16 }, { "new orleans", 18 }, { "austin", 18 }, { "edinburg", 18 }, { "san antonio", 18 },
{ "the woodlands", 18 }
};
std::transform(in.begin(), in.end(), in.begin(), ::tolower);
{
auto it = area.find(in);
if (it != area.end())
return it->second;
}
if (all_of(in.begin(), in.end(), ::isdigit))
return std::stoi(in);
throw std::invalid_argument("Bad AREA string");
}
int main()
{
cout << "----------Work Flow Assistant----------" << endl << endl;
try
{
std::string temp;
std::cout << "Please enter the ticket OU:\n";
std::cin >> temp;
int ou = get_OU(std::move(temp));
std::cout << "\nPlease enter the city the ticket originates from:\n";
std::cin >> temp;
int area = get_area(std::move(temp));
std::cout << "\n\n";
if (ou == 101 && area == 1)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 102 && area == 1)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 103 && area == 1)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 104 && area == 1)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 101 && area == 2)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 102 && area == 2)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 103 && area == 2)
{
std::cout << "Your tech is John Doe.\n";
}
else if (ou == 104 && area == 2)
{
std::cout << "Your tech is John Doe.\n";
}
}
catch (std::exception& e)
{
std::cerr << e.what();
return EXIT_FAILURE;
}
system("pause");
return 0;
}
|