Commit 7c040dd6 authored by Elon Bontemps's avatar Elon Bontemps
Browse files

autosave

parents cd0cc8c1 37773ebd
...@@ -7,14 +7,17 @@ ...@@ -7,14 +7,17 @@
using namespace std; using namespace std;
//function returns map of pairs //function returns map of pairs
map<string, pair<double, double>> mapMaker() { pair<double, double> longAndLat () {
ifstream fin; ifstream fin;
fin.open("countries.txt"); fin.open("countries.txt");
//cout << "What city/country are you from/closest to: " ifstream filestream("countries.txt");
print("Print this", filestream);
//variables //variables
map<string, pair<double, double>> tempMap; vector <pair<double, double>> coordinateVector;
pair<double,double> tempPair; map<string, pair<double, double>> tempMap();
string placeName; string placeName;
int cityNum;
if(!fin.is_open()) { if(!fin.is_open()) {
cerr << "Error couldn't open file." << endl; cerr << "Error couldn't open file." << endl;
...@@ -22,13 +25,37 @@ map<string, pair<double, double>> mapMaker() { ...@@ -22,13 +25,37 @@ map<string, pair<double, double>> mapMaker() {
} }
while(!fin.eof()) { while(!fin.eof()) {
pair<double,double> tempPair;
getline(fin, placeName, '.'); getline(fin, placeName, '.');
getline(fin, tempPair.first, '.'); getline(fin, tempPair.first, '.');
getline(fin, tempPair.second, '\n'); getline(fin, tempPair.second, '\n');
coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector
tempMap.emplace(placeName, tempPair); tempMap.emplace(placeName, tempPair);
placeName.clear();
} }
//<<<<<<< HEAD
return tempMap; return tempMap;
} }
//=======
//output the country.txt file onto the system
//give eric the specific line the user chooses in the text file and give just coordimnates // TODO Print the cities
do {
cout << "Which city do you live in/live near?: ";
if (!(cin >> cityNum)) { // validates that numbers were entered and checks input
cerr << "Error! Please enter a valid integar." << endl;
cin.clear();
cin.ignore(1000, '\n');
continue;
}
if (cityNum > 0 && cityNum < 40) {
break;
} else {
cerr << "Error! Invalid year. Please enter a year between 1 and 9099" << endl;
}
} while (true);
return coordinateVector.at(cityNum - 1);
}
//>>>>>>> 37773ebd81c48909890df464721d8b1870634f96
This diff is collapsed.
...@@ -20,4 +20,7 @@ Who does what (tentative): ...@@ -20,4 +20,7 @@ Who does what (tentative):
- orbital models (visual aid) (Elizabeth) - orbital models (visual aid) (Elizabeth)
- Pass user input to algorithm (Brandon and Moses) - Pass user input to algorithm (Brandon and Moses)
- User interface (Elon) - User interface (Elon)
- Algorithm (Eric) - Algorithm (Eric)
\ No newline at end of file -
The project that Eric, Brandon
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment