Forked from ebba0194/gist:fc242f1cc66c9a2f411bbb20d17d6036
Last active
December 7, 2017 15:52
-
-
Save aepod/0f3088a930e28aeb6036255bfb747918 to your computer and use it in GitHub Desktop.
8.1 cities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <map> | |
using namespace std; | |
string province(string); | |
typedef map<string,string> , ProvinceList; | |
int main(){ | |
string city, abbrev, prov; | |
cout<<"Enter city: "; | |
getline(cin,city); | |
cout<<"Enter province abbreviation: "; | |
cin>>abbrev; | |
prov = province(abbrev); | |
cout<<city+prov; | |
return (0); | |
} | |
string province (string abbrev){ | |
typedef map<string,string> , ProvinceListMap; | |
ProvinceListMap ProvinceList; | |
ProvinceList["BC"] = "British Columbia"; | |
return ProvinceList.find(abbrev)->second; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment