Commit 02ba8f78 authored by Eric Walsh's avatar Eric Walsh

Merge branch 'master' of gitlab.cs.wallawalla.edu:walser/project-3-star-gazing

parents f102912c 75079868
......@@ -23,7 +23,7 @@ int yearPrompt () { // empty argument
if (isLeap(year)) { // Tells user if it is a leap year of not
cout << "This is a leap year." << endl;
} else if (!isLeap(year)) {
cout << "This is not a leap yar." << endl;
cout << "This is not a leap year." << endl;
}
if (year > 0 && year < 9099) {
return year;
......@@ -36,7 +36,7 @@ int yearPrompt () { // empty argument
string monthPrompt () {
string month;
do {
cout << "Enter month: ";
cout << "Enter month (ex.April, May): ";
cin >> month;
if (month == "January" || month == "February" || month == "March" || month == "April" || month == "May" || month == "June" || month == "July" || month == "August" || month == "September" || month == "October" || month == "November" || month == "December") {
return month;
......@@ -440,7 +440,6 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
vector <pair<double, double>> constellationCoordinates () { // Function to store the coordinates of the constellations
vector <pair<double, double>> coordinates;
cout << "Made it here 1" << endl;
// Canis Major
coordinates.push_back(make_pair(7.45, -9.0));
coordinates.push_back(make_pair(6.1, -9.0));
......@@ -544,40 +543,41 @@ vector <pair<double, double>> constellationCoordinates () { // Function to store
coordinates.push_back(make_pair(13.7, 32.0));
coordinates.push_back(make_pair(8.6, 32.0));
cout << "Made it here 2" << endl;
return coordinates;
}
void printConstellation (vector <pair<double,double>> constellationCoordinates, vector <pair<double,double>> window) {
//double windowLeft = window.at()
// variables
double windowLeft = window.at(0).first;
double windowRight = window.at(1).first;
double windowTop = window.at(0).second;
double windowBottom = window.at(3).second;
int inrangeCount = 0;
int coordinateCount = 0;
cout << "Made it here 3" << endl;
for(unsigned int j = 0; j < ((constellationCoordinates.size() + 1) / 4); j++) {
for(unsigned int j = 0; j < (constellationCoordinates.size() / 4) - 1; j++) {
inrangeCount = 0;
for (int i = 0; i < 4; i++) {
coordinateCount++;
if(((window.at(0).first) > (constellationCoordinates.at(coordinateCount).first)) && ((window.at(1).first) < (constellationCoordinates.at(coordinateCount).first))
&& ((window.at(2).first) > (constellationCoordinates.at(coordinateCount).first)) && ((window.at(3).first) < (constellationCoordinates.at(coordinateCount).first))
&& ((window.at(0).second) > (constellationCoordinates.at(coordinateCount).second)) && ((window.at(1).second) < (constellationCoordinates.at(coordinateCount).second))
&& ((window.at(2).second) > (constellationCoordinates.at(coordinateCount).second)) && ((window.at(3).second) < (constellationCoordinates.at(coordinateCount).second))) {
if((windowLeft > constellationCoordinates.at(coordinateCount).first) && (constellationCoordinates.at(coordinateCount).first < windowRight)
&& (windowTop > constellationCoordinates.at(coordinateCount).second) && (constellationCoordinates.at(coordinateCount).second > windowBottom)) {
inrangeCount++;
}
}
if (inrangeCount == 4) {
cout << "Constellation" << constellationNamer(coordinateCount) << "is fully in view." << endl
<< "Here is an image." << endl;
constellationOutputter(coordinateCount);
cout << "Constellation" << constellationNamer(coordinateCount - 1) << "is fully in view." << endl
<< "Here is an image." << endl << "============================================" << endl;
constellationOutputter(coordinateCount - 1);
} else if (inrangeCount < 4 && inrangeCount > 0) {
cout << "Constellation" << constellationNamer(coordinateCount) << "is partially in view." << endl
<< "Here is an image." << endl;
constellationOutputter(coordinateCount);
cout << "Constellation" << constellationNamer(coordinateCount - 1) << "is partially in view." << endl
<< "Here is an image." << endl << "============================================" << endl;
constellationOutputter(coordinateCount - 1);
} else {
cout << endl;
}
}
}
......
......@@ -33,7 +33,6 @@ pair<double,double> longAndLat () {
tempPair.second = stod(temp2);
coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector
}
// TODO Print the cities
do {
cout << endl << "In the list about, which city do you live in/live near? (enter number): ";
......
1. Seattle, Washington. 47.6062° N. 122.3321° W
2. Boise, Idaho. 43.6150° N. 116.2023° W
3. Helena, Montana. 46.5891° N. 112.0391° W
4.Saint Paul, Minessota. 44.9537° N. 93.0900° W
4. Saint Paul, Minessota. 44.9537° N. 93.0900° W
5. Madison, Wisconson. 43.0731° N. 89.4012° W
6. New York, New York. 40.7128° N. 74.0060° W
7. Augusta, Maine. 44.3106° N. 69.7795° W
......
......@@ -17,7 +17,8 @@ int main () {
int minuteInput = 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 {
......@@ -60,7 +61,10 @@ int main () {
cout << "The algorithm function, when its January 27, 2017, at 5:45:54 pm, at a lat and long of -46,89 and when looking at the sky at 20, 270 (in horizontal coordinates), gives: " << endl
<< "Right ascention of: " << returnValue.first << " and a declination of: " << returnValue.second << endl;
printConstellation(constellationCoordinates(), viewFinder(returnValue));
window = viewFinder(returnValue);
coordinates = constellationCoordinates ();
printConstellation(coordinates, window);
} while (false);
......
#include <iostream>
#include "Functions.h"
#include "Stars.h"
#include <vector>
#include <string>
#include <utility>
......@@ -34,6 +35,7 @@ int main () {
cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl;
do {
//Stars a;
// yearInput = yearPrompt();
// monthInput = monthPrompt();
......@@ -45,11 +47,10 @@ int main () {
// minuteInput = minutePrompt();
// testPair = altAndAziPair ();
// cout << "Made it here 4" << endl;
// printConstellation (coordinates, window);
printConstellation (coordinates, window);
// for (int i = 0; i < coordinates.size(); i++) {
// cout << coordinates.at(i).first << endl;
// for (unsigned int i = 0; i < coordinates.size(); i++) {
// cout << coordinates.at(i).first << " , ";
// cout << coordinates.at(i).second << endl;
// }
} while (false);
......
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