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
c9189b9c
Commit
c9189b9c
authored
Mar 20, 2019
by
Eric Walsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autosave
parent
9c96b409
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
65 deletions
+93
-65
Final stuff/Functions.cpp
Final stuff/Functions.cpp
+24
-0
Final stuff/Functions.h
Final stuff/Functions.h
+3
-1
Final stuff/main.cpp
Final stuff/main.cpp
+66
-64
No files found.
Final stuff/Functions.cpp
View file @
c9189b9c
...
...
@@ -698,3 +698,27 @@ void constellationOutputter (int index) {
cout
<<
endl
;
}
}
bool
restart
(){
bool
goodInput
;
char
input
;
cout
<<
"Would you like to quit? (y/n): "
<<
endl
;
do
{
cin
>>
input
;
tolower
(
input
);
if
(
input
!=
'y'
||
input
!=
'n'
){
goodInput
=
false
;
cerr
<<
"Error: Invalid input. Try again."
<<
endl
;
cin
.
clear
();
}
else
{
goodInput
=
true
;
}
}
while
(
!
goodInput
);
if
(
input
==
'y'
){
return
false
;
}
else
{
return
true
;
}
}
\ No newline at end of file
Final stuff/Functions.h
View file @
c9189b9c
...
...
@@ -29,4 +29,6 @@ void printConstellation (vector <pair<double,double>> constellationCoordinates,
string
constellationNamer
(
int
index
);
// funciton to name all the constellations
void
constellationOutputter
(
int
index
);
// function to output the images of the constellations
\ No newline at end of file
void
constellationOutputter
(
int
index
);
// function to output the images of the constellations
bool
restart
();
//restarts the program if the user wants to
\ No newline at end of file
Final stuff/main.cpp
View file @
c9189b9c
...
...
@@ -9,72 +9,74 @@
using
namespace
std
;
int
main
()
{
//variables
string
monthInput
;
char
endMenu
;
int
monthDay
=
0
;
int
yearInput
=
0
;
int
hourInput
=
0
;
int
minuteInput
=
0
;
double
hoursSinceYear
=
0
;
pair
<
double
,
double
>
AltAndAziPair
;
pair
<
double
,
double
>
longAndLatPair
;
vector
<
pair
<
double
,
double
>>
window
;
vector
<
pair
<
double
,
double
>>
coordinates
;
cout
<<
"==============Welcome to the Star-Gazer v 1.0=============="
<<
endl
;
do
{
yearInput
=
yearPrompt
();
monthInput
=
monthPrompt
();
monthDay
=
dayPrompt
(
monthInput
,
yearInput
);
hourInput
=
hourPrompt
();
minuteInput
=
minutePrompt
();
AltAndAziPair
=
altAndAziPair
();
printCities
();
longAndLatPair
=
longAndLat
();
//calculating the julian date
// cout << "if the date is January 27, 2017 at 5:45:54.6 pm, the julian date function should return 2457781.240208." << endl
// << "It actually returns: " << julian(2017, 641.9) << endl;
// cout << "if the date is January 1, 2000 at 00:00:00, the GMST date function should return: 6.79519916667." << endl
// << "It actually returns: " << GMST(2000, 0) << endl;
// //converting time and longitude to phi
/*cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 4.65147698949." << endl
<< "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/
//test the algorithm as a whole
// pair<double, double> test;
// test.first = -46;
// test.second = 89;
// pair<double,double> horizontal;
// horizontal.first = 20;
// horizontal.second = 270;
hoursSinceYear
=
dateToHour
(
monthInput
,
yearInput
,
monthDay
,
hourInput
,
minuteInput
);
pair
<
double
,
double
>
returnValue
;
returnValue
=
algorithm
(
hoursSinceYear
,
longAndLatPair
,
AltAndAziPair
,
yearInput
);
//cout << "The function returns a right ascention of: " << returnValue.first << " and a declination of: " << returnValue.second << endl;
window
=
viewFinder
(
returnValue
);
coordinates
=
constellationCoordinates
();
printConstellation
(
coordinates
,
window
);
do
{
//variables
string
monthInput
;
char
endMenu
;
int
monthDay
=
0
;
int
yearInput
=
0
;
int
hourInput
=
0
;
int
minuteInput
=
0
;
double
hoursSinceYear
=
0
;
pair
<
double
,
double
>
AltAndAziPair
;
pair
<
double
,
double
>
longAndLatPair
;
vector
<
pair
<
double
,
double
>>
window
;
vector
<
pair
<
double
,
double
>>
coordinates
;
cout
<<
"==============Welcome to the Star-Gazer v 1.0=============="
<<
endl
;
do
{
yearInput
=
yearPrompt
();
}
while
(
true
);
//cout << dateToHour(yearInput, monthInput, monthDay, hourInput, minuteInput) << endl;
monthInput
=
monthPrompt
();
monthDay
=
dayPrompt
(
monthInput
,
yearInput
);
hourInput
=
hourPrompt
();
minuteInput
=
minutePrompt
();
AltAndAziPair
=
altAndAziPair
();
printCities
();
longAndLatPair
=
longAndLat
();
//calculating the julian date
// cout << "if the date is January 27, 2017 at 5:45:54.6 pm, the julian date function should return 2457781.240208." << endl
// << "It actually returns: " << julian(2017, 641.9) << endl;
// cout << "if the date is January 1, 2000 at 00:00:00, the GMST date function should return: 6.79519916667." << endl
// << "It actually returns: " << GMST(2000, 0) << endl;
// //converting time and longitude to phi
/*cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 4.65147698949." << endl
<< "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/
//test the algorithm as a whole
// pair<double, double> test;
// test.first = -46;
// test.second = 89;
// pair<double,double> horizontal;
// horizontal.first = 20;
// horizontal.second = 270;
hoursSinceYear
=
dateToHour
(
monthInput
,
yearInput
,
monthDay
,
hourInput
,
minuteInput
);
pair
<
double
,
double
>
returnValue
;
returnValue
=
algorithm
(
hoursSinceYear
,
longAndLatPair
,
AltAndAziPair
,
yearInput
);
//cout << "The function returns a right ascention of: " << returnValue.first << " and a declination of: " << returnValue.second << endl;
window
=
viewFinder
(
returnValue
);
coordinates
=
constellationCoordinates
();
printConstellation
(
coordinates
,
window
);
}
while
(
true
);
//cout << dateToHour(yearInput, monthInput, monthDay, hourInput, minuteInput) << endl;
}
while
(
restart
());
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