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 ...@@ -23,7 +23,7 @@ int yearPrompt () { // empty argument
if (isLeap(year)) { // Tells user if it is a leap year of not if (isLeap(year)) { // Tells user if it is a leap year of not
cout << "This is a leap year." << endl; cout << "This is a leap year." << endl;
} else if (!isLeap(year)) { } 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) { if (year > 0 && year < 9099) {
return year; return year;
...@@ -36,7 +36,7 @@ int yearPrompt () { // empty argument ...@@ -36,7 +36,7 @@ int yearPrompt () { // empty argument
string monthPrompt () { string monthPrompt () {
string month; string month;
do { do {
cout << "Enter month: "; cout << "Enter month (ex.April, May): ";
cin >> month; 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") { 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; return month;
...@@ -440,7 +440,6 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -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>> constellationCoordinates () { // Function to store the coordinates of the constellations
vector <pair<double, double>> coordinates; vector <pair<double, double>> coordinates;
cout << "Made it here 1" << endl;
// Canis Major // Canis Major
coordinates.push_back(make_pair(7.45, -9.0)); coordinates.push_back(make_pair(7.45, -9.0));
coordinates.push_back(make_pair(6.1, -9.0)); coordinates.push_back(make_pair(6.1, -9.0));
...@@ -543,41 +542,42 @@ vector <pair<double, double>> constellationCoordinates () { // Function to store ...@@ -543,41 +542,42 @@ vector <pair<double, double>> constellationCoordinates () { // Function to store
coordinates.push_back(make_pair(8.6, 61.0)); coordinates.push_back(make_pair(8.6, 61.0));
coordinates.push_back(make_pair(13.7, 32.0)); coordinates.push_back(make_pair(13.7, 32.0));
coordinates.push_back(make_pair(8.6, 32.0)); coordinates.push_back(make_pair(8.6, 32.0));
cout << "Made it here 2" << endl;
return coordinates; return coordinates;
} }
void printConstellation (vector <pair<double,double>> constellationCoordinates, vector <pair<double,double>> window) { 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 inrangeCount = 0;
int coordinateCount = 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; inrangeCount = 0;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
coordinateCount++; coordinateCount++;
if(((window.at(0).first) > (constellationCoordinates.at(coordinateCount).first)) && ((window.at(1).first) < (constellationCoordinates.at(coordinateCount).first)) if((windowLeft > constellationCoordinates.at(coordinateCount).first) && (constellationCoordinates.at(coordinateCount).first < windowRight)
&& ((window.at(2).first) > (constellationCoordinates.at(coordinateCount).first)) && ((window.at(3).first) < (constellationCoordinates.at(coordinateCount).first)) && (windowTop > constellationCoordinates.at(coordinateCount).second) && (constellationCoordinates.at(coordinateCount).second > windowBottom)) {
&& ((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))) {
inrangeCount++; inrangeCount++;
} }
} }
if (inrangeCount == 4) { if (inrangeCount == 4) {
cout << "Constellation" << constellationNamer(coordinateCount) << "is fully in view." << endl cout << "Constellation" << constellationNamer(coordinateCount - 1) << "is fully in view." << endl
<< "Here is an image." << endl; << "Here is an image." << endl << "============================================" << endl;
constellationOutputter(coordinateCount);
constellationOutputter(coordinateCount - 1);
} else if (inrangeCount < 4 && inrangeCount > 0) { } else if (inrangeCount < 4 && inrangeCount > 0) {
cout << "Constellation" << constellationNamer(coordinateCount) << "is partially in view." << endl cout << "Constellation" << constellationNamer(coordinateCount - 1) << "is partially in view." << endl
<< "Here is an image." << endl; << "Here is an image." << endl << "============================================" << endl;
constellationOutputter(coordinateCount); constellationOutputter(coordinateCount - 1);
} else { } else {
cout << endl; cout << endl;
} }
} }
} }
......
...@@ -33,8 +33,7 @@ pair<double,double> longAndLat () { ...@@ -33,8 +33,7 @@ pair<double,double> longAndLat () {
tempPair.second = stod(temp2); tempPair.second = stod(temp2);
coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector
} }
// TODO Print the cities
do { do {
cout << endl << "In the list about, which city do you live in/live near? (enter number): "; cout << endl << "In the list about, which city do you live in/live near? (enter number): ";
if (!(cin >> cityNum)) { // validates that numbers were entered and checks input if (!(cin >> cityNum)) { // validates that numbers were entered and checks input
......
1. Seattle, Washington. 47.6062° N. 122.3321° W 1. Seattle, Washington. 47.6062° N. 122.3321° W
2. Boise, Idaho. 43.6150° N. 116.2023° W 2. Boise, Idaho. 43.6150° N. 116.2023° W
3. Helena, Montana. 46.5891° N. 112.0391° 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 5. Madison, Wisconson. 43.0731° N. 89.4012° W
6. New York, New York. 40.7128° N. 74.0060° W 6. New York, New York. 40.7128° N. 74.0060° W
7. Augusta, Maine. 44.3106° N. 69.7795° W 7. Augusta, Maine. 44.3106° N. 69.7795° W
8. Los-Angeles, California. 34.0522° N. 118.2437° W 8. Los-Angeles, California. 34.0522° N. 118.2437° W
9. Salt Lake City, Utah. 40.7608° N. 111.8910° W 9. Salt Lake City, Utah. 40.7608° N. 111.8910° W
10. Topeka, Kansas. 39.0473° N. 95.6752° W 10. Topeka, Kansas. 39.0473° N. 95.6752° W
11. Raleigh, North Carolina. 35.7796° N. 78.6382° W 11. Raleigh, North Carolina. 35.7796° N. 78.6382° W
12. Austin, Texas. 30.2672° N. 97.7431° W 12. Austin, Texas. 30.2672° N. 97.7431° W
......
...@@ -17,7 +17,8 @@ int main () { ...@@ -17,7 +17,8 @@ int main () {
int minuteInput = 0; int minuteInput = 0;
pair <double,double> AltAndAziPair; pair <double,double> AltAndAziPair;
pair <double, double> longAndLatPair; pair <double, double> longAndLatPair;
vector <pair<double,double>> window;
vector <pair<double,double>> coordinates;
cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl; cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl;
do { do {
...@@ -60,7 +61,10 @@ int main () { ...@@ -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 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; << "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); } while (false);
......
#include <iostream> #include <iostream>
#include "Functions.h" #include "Functions.h"
#include "Stars.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <utility> #include <utility>
...@@ -34,6 +35,7 @@ int main () { ...@@ -34,6 +35,7 @@ int main () {
cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl; cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl;
do { do {
//Stars a;
// yearInput = yearPrompt(); // yearInput = yearPrompt();
// monthInput = monthPrompt(); // monthInput = monthPrompt();
...@@ -45,11 +47,10 @@ int main () { ...@@ -45,11 +47,10 @@ int main () {
// minuteInput = minutePrompt(); // minuteInput = minutePrompt();
// testPair = altAndAziPair (); // testPair = altAndAziPair ();
// cout << "Made it here 4" << endl; printConstellation (coordinates, window);
// printConstellation (coordinates, window);
// for (unsigned int i = 0; i < coordinates.size(); i++) {
// for (int i = 0; i < coordinates.size(); i++) { // cout << coordinates.at(i).first << " , ";
// cout << coordinates.at(i).first << endl;
// cout << coordinates.at(i).second << endl; // cout << coordinates.at(i).second << endl;
// } // }
} while (false); } 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