Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
Project 3 Star Gazing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Walsh
Project 3 Star Gazing
Commits
36d28a36
Commit
36d28a36
authored
Mar 19, 2019
by
Brandon Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autosave
parent
17a793ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
20 deletions
+78
-20
Countries/coordinates.txt
Countries/coordinates.txt
+39
-1
Countries/countries.cpp
Countries/countries.cpp
+28
-16
Countries/countries.h
Countries/countries.h
+4
-1
Countries/main.cpp
Countries/main.cpp
+7
-2
No files found.
Countries/coordinates.txt
View file @
36d28a36
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
Countries/countries.cpp
View file @
36d28a36
...
...
@@ -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
Countries/countries.h
View file @
36d28a36
...
...
@@ -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
();
Countries/main.cpp
View file @
36d28a36
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment