Commit 36d28a36 authored by Brandon Reid's avatar Brandon Reid

autosave

parent 17a793ec
ff
\ No newline at end of file
47.6062,22.3321
43.6150,116.2023
46.5891,112.0391
44.9537,93.0900
43.0731,89.4012
40.7128,74.0060
44.3106,69.7795
34.0522,118.2437
40.7608,11.8910
39.0473,95.6752
35.7796,78.6382
30.2672,97.7431
25.7617,80.1918
4.7110,74.0721
15.8267,47.9218
34.6037,58.3816
12.6948,28.4280
16.9742,7.9865
16.8740,11.4339
34.0181,5.0078
2.7405,10.0304
2.9492,25.9231
17.3082,15.8452
16.3693,36.7820
22.4009,46.1279
23.9052,42.9125
49.0945,30.4051
48.8566,2.3522
56.3588,44.0767
21.1458,79.0882
31.4762,92.0512
44.6692,102.1719
24.8741,118.6757
35.1796,129.0756
35.1814,136.9064
30.7490,121.4660
29.0139,134.7533
23.3593,119.7350
33.8688,151.2093
\ No newline at end of file
......@@ -3,20 +3,18 @@
#include <utility>
#include <string>
#include <map>
#include <fstream>
#include <vector>
using namespace std;
//function returns map of pairs
pair<double, double> longAndLat () {
pair<double,double> longAndLat () {
ifstream fin;
fin.open("countries.txt");
ifstream filestream("countries.txt");
print("Print this", filestream);
fin.open("coordinates.txt");
//variables
vector <pair<double, double>> coordinateVector;
map<string, pair<double, double>> tempMap();
string placeName;
vector <pair<double,double>> coordinateVector;
int cityNum;
if(!fin.is_open()) {
......@@ -25,17 +23,17 @@ pair<double, double> longAndLat () {
}
while(!fin.eof()) {
cout << "Howdy " << endl;
string temp1;
string temp2;
pair<double,double> tempPair;
getline(fin, placeName, '.');
getline(fin, tempPair.first, '.');
getline(fin, tempPair.second, '\n');
//getline(fin, placeName, '.');
getline(fin, temp1, ',');
getline(fin, temp2, '\n');
tempPair.first = stod(temp1);
tempPair.second = stod(temp2);
coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector
tempMap.emplace(placeName, tempPair);
placeName.clear();
}
return tempMap;
}
// TODO Print the cities
do {
......@@ -53,6 +51,20 @@ pair<double, double> longAndLat () {
}
} while (true);
fin.close();
return coordinateVector.at(cityNum - 1);
}
void printCities () {
char contents;
ifstream fin;
fin.open("countries.txt");
fin.get(contents);
while(!fin.eof()) {
cout << contents;
fin.get(contents);
}
fin.close();
}
\ No newline at end of file
......@@ -2,4 +2,7 @@
using namespace std;
//function that return maps of pairs
map<string, pair<double, double>> mapMaker;
pair<double,double> longAndLat ();
void printCities ();
......@@ -14,16 +14,21 @@
#include <iostream>
#include "countries.cpp"
#include <vector>
#include <string>
using namespace std;
int main {
int main () {
//Welcomeing the user
cout << "Welcome to the Star Gazer Application!" << endl;
pair<double, double> longAndLat ();
//printCities();
longAndLat ();
return 0;
}
\ No newline at end of file
Markdown is supported
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