diff --git a/Input stuff/Functions.cpp b/Final stuff/Functions.cpp similarity index 95% rename from Input stuff/Functions.cpp rename to Final stuff/Functions.cpp index 6a4dda4d6a1ab82672086b821478ca3c49c9fefb..e09275ca01893ee5575da9bf352d3801a1521468 100644 --- a/Input stuff/Functions.cpp +++ b/Final stuff/Functions.cpp @@ -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 > viewFinder (pair centerPt) { // f vector > constellationCoordinates () { // Function to store the coordinates of the constellations vector > 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)); @@ -543,41 +542,42 @@ vector > constellationCoordinates () { // Function to store coordinates.push_back(make_pair(8.6, 61.0)); 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 > constellationCoordinates, vector > 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; } + } } diff --git a/Input stuff/Functions.h b/Final stuff/Functions.h similarity index 100% rename from Input stuff/Functions.h rename to Final stuff/Functions.h diff --git a/Input stuff/Stars.cpp b/Final stuff/Stars.cpp similarity index 100% rename from Input stuff/Stars.cpp rename to Final stuff/Stars.cpp diff --git a/Input stuff/Stars.h b/Final stuff/Stars.h similarity index 100% rename from Input stuff/Stars.h rename to Final stuff/Stars.h diff --git a/Final stuff/countries.cpp b/Final stuff/countries.cpp index fdb6dbc7a897042e1a5cb83fb31673e16ea28e72..7601750992043877bbb253bf2ee2020110598e4b 100644 --- a/Final stuff/countries.cpp +++ b/Final stuff/countries.cpp @@ -33,8 +33,7 @@ pair 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): "; if (!(cin >> cityNum)) { // validates that numbers were entered and checks input diff --git a/Final stuff/countries.txt b/Final stuff/countries.txt index 2c0724047f4c42a2d286b28a90afc32dfdbf9595..fe3ee9beced0f34ac50463401679ee311ca827f1 100644 --- a/Final stuff/countries.txt +++ b/Final stuff/countries.txt @@ -1,12 +1,12 @@ -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 -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 -8. Los-Angeles, California. 34.0522° N. 118.2437° W -9. Salt Lake City, Utah. 40.7608° N. 111.8910° W +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 +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 +8. Los-Angeles, California. 34.0522° N. 118.2437° W +9. Salt Lake City, Utah. 40.7608° N. 111.8910° W 10. Topeka, Kansas. 39.0473° N. 95.6752° W 11. Raleigh, North Carolina. 35.7796° N. 78.6382° W 12. Austin, Texas. 30.2672° N. 97.7431° W diff --git a/Final stuff/main.cpp b/Final stuff/main.cpp index 84b8e39de8751949257143d415a2784ba7c7d273..aacf07e35b2d02c6613662ba3dfed012266b3234 100644 --- a/Final stuff/main.cpp +++ b/Final stuff/main.cpp @@ -17,7 +17,8 @@ int main () { int minuteInput = 0; pair AltAndAziPair; pair longAndLatPair; - + vector > window; + vector > 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); diff --git a/Input stuff/main.cpp b/Input stuff/main.cpp index 8babb68ef475ce793dbbf3839f56c0c3ef88ffcb..5866962246f2ee5befb8230afa48becd9b3b92d2 100644 --- a/Input stuff/main.cpp +++ b/Input stuff/main.cpp @@ -1,5 +1,6 @@ #include #include "Functions.h" +#include "Stars.h" #include #include #include @@ -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); - - // for (int i = 0; i < coordinates.size(); i++) { - // cout << coordinates.at(i).first << endl; + printConstellation (coordinates, window); + + // for (unsigned int i = 0; i < coordinates.size(); i++) { + // cout << coordinates.at(i).first << " , "; // cout << coordinates.at(i).second << endl; // } } while (false);