Commit 4e4009db authored by Eric Walsh's avatar Eric Walsh

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

parents 86672a21 d22fac68
......@@ -49,4 +49,6 @@ int main(){
returnValue = algorithm(8, test, horizontal, 2019);
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;
}
ff
\ No newline at end of file
Seattle, Washington. 47.6062° N. 122.3321° W
Boise, Idaho. 43.6150° N. 116.2023° W
Helena, Montana. 46.5891° N. 112.0391° W
Saint Paul, Minessota. 44.9537° N. 93.0900° W
Madison, Wisconson. 43.0731° N. 89.4012° W
New York, New York. 40.7128° N. 74.0060° W
Augusta, Maine. 44.3106° N. 69.7795° W
Los-Angeles, California. 34.0522° N. 118.2437° W
Salt Lake City, Utah. 40.7608° N. 111.8910° W
Topeka, Kansas. 39.0473° N. 95.6752° W
Raleigh, North Carolina. 35.7796° N. 78.6382° W
Austin, Texas. 30.2672° N. 97.7431° W
Miami, Florida. 25.7617° N. 80.1918° W
Bogota, Columbia. 4.7110° N. 74.0721° W
Brasilia, Brazil 15.8267° S. 47.9218° W
Buenos Aires, Argentina 34.6037° S. 58.3816° W
En Nahud, Sudan 12.6948° N. 28.4280° E
Agadez, Niger 16.9742° N. 7.9865° E
Kiffa, Mauritana 16.8740° N. 11.4339° W
Fes, Morocco 34.0181° N. 5.0078° W
Gamba, Gabon 2.7405° S. 10.0304° E
Kindu, Democratic Republic of the Congo 2.9492° S. 25.9231° E
Namacunde, Angola 17.3082° S. 15.8452° E
Lugela, Mozambique 16.3693° S. 36.7820° E
Ihosy, Madagascar 22.4009° S. 46.1279° E
Afif, Saudi Arabia 23.9052° N. 42.9125° E
Buky, Ukraine 49.0945° N. 30.4051° E
Paris, France 48.8566° N. 2.3522° E
Bor, Russia 56.3588° N. 44.0767° E
Nagpur, India 21.1458° N. 79.0882° E
Naggu, Tibet 31.4762° N. 92.0512° E
Bogd, Mongolia 44.6692° N. 102.1719° E
Quanzhou, Fujian 24.8741° N. 118.6757° E
Busan, South Korea 35.1796° N. 129.0756° E
Nagoya, Japan 35.1814° N. 136.9064° E
Kalgorie, Australia 30.7490° S. 121.4660° E
Coober Pedy, South Australia. 29.0139° S. 134.7533° E
Newman, Western Australia. 23.3593° S. 119.7350° E
Sydney, Australia 33.8688° S. 151.2093° E
\ No newline at end of file
......@@ -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
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
......@@ -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,21 +23,20 @@ pair<double, double> longAndLat () {
}
while(!fin.eof()) {
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 {
cout << "Which city do you live in/live near?: ";
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
cerr << "Error! Please enter a valid integar." << endl;
cin.clear();
......@@ -53,6 +50,21 @@ pair<double, double> longAndLat () {
}
} while (true);
fin.close();
return coordinateVector.at(cityNum - 1);
}
void printCities () {
cout << endl << endl << "City list" << endl << "========" << endl;
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
......@@ -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 ();
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
13. Miami, Florida. 25.7617° N. 80.1918° W
14. Bogota, Columbia. 4.7110° N. 74.0721° W
15. Brasilia, Brazil 15.8267° S. 47.9218° W
16. Buenos Aires, Argentina 34.6037° S. 58.3816° W
17. En Nahud, Sudan 12.6948° N. 28.4280° E
18. Agadez, Niger 16.9742° N. 7.9865° E
19. Kiffa, Mauritana 16.8740° N. 11.4339° W
20. Fes, Morocco 34.0181° N. 5.0078° W
21. Gamba, Gabon 2.7405° S. 10.0304° E
22. Kindu, Democratic Republic of the Congo 2.9492° S. 25.9231° E
23. Namacunde, Angola 17.3082° S. 15.8452° E
24. Lugela, Mozambique 16.3693° S. 36.7820° E
25. Ihosy, Madagascar 22.4009° S. 46.1279° E
26. Afif, Saudi Arabia 23.9052° N. 42.9125° E
27. Buky, Ukraine 49.0945° N. 30.4051° E
28. Paris, France 48.8566° N. 2.3522° E
29. Bor, Russia 56.3588° N. 44.0767° E
30. Nagpur, India 21.1458° N. 79.0882° E
31. Naggu, Tibet 31.4762° N. 92.0512° E
32. Bogd, Mongolia 44.6692° N. 102.1719° E
33. Quanzhou, Fujian 24.8741° N. 118.6757° E
34. Busan, South Korea 35.1796° N. 129.0756° E
35. Nagoya, Japan 35.1814° N. 136.9064° E
36. Kalgorie, Australia 30.7490° S. 121.4660° E
37. Coober Pedy, South Australia. 29.0139° S. 134.7533° E
38. Newman, Western Australia. 23.3593° S. 119.7350° E
39. Sydney, Australia 33.8688° S. 151.2093° E
\ No newline at end of file
#include <iostream>
#include "Functions.h"
#include "countries.h"
#include "Algorithm.h"
#include <vector>
#include <string>
#include <utility>
using namespace std;
int main () {
//variables
string monthInput;
int monthDay = 0;
int yearInput = 0;
int hourInput = 0;
int minuteInput = 0;
pair <double,double> AltAndAziPair;
pair <double, double> longAndLatPair;
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;
pair<double,double> returnValue;
returnValue = algorithm(641.9, longAndLatPair, AltAndAziPair, 2017);
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));
} while (false);
//cout << dateToHour(yearInput, monthInput, monthDay, hourInput, minuteInput) << endl;
return 0;
}
\ No newline at end of file
/****************************************************
* File: Constellation.h
* Description: Array to output constalltions (try an array and as an image)
* *****************/
#ifndef STARS_H
#define STARS_H
#include <iostream>
const int ROW = 24;
const int COL = 40;
class Stars {
public:
char UrsaMinor();
char UrsaMajor();
// Winter(); ?? maybe
//////////////
char CanisMajor();
char Eridanius();
char Gemini();
char Orion();
char Tarus();
// Spring(); ??
//////////////
char Bootes();
char Cancer();
char Leo();
char Virgo();
// Summer(); ??
/////////////
char Aquila();
char Sagistarius();
char Scorpius();
// Fall(); ??
///////////
char Capricornus();
char Pegasus();
char Pisces();
private:
// const int ROW = 24;
// const int COL = 40;
char stars[ROW][COL];
};
#endif
\ No newline at end of file
#include "Functions.h"
#include "Stars.h"
#include "Constellation.h"
#include <string>
#include <iostream>
#include <vector>
......@@ -441,251 +440,123 @@ 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
pair<double, double> pair1a;
pair1a = make_pair(7.45, -9.0);
coordinates.push_back(pair1a);
pair<double, double> pair1b;
pair1b = make_pair(6.1, -9.0);
coordinates.push_back(pair1b);
pair<double, double> pair1c;
pair1c = make_pair(7.45, -33.0);
coordinates.push_back(pair1c);
pair<double, double> pair1d;
pair1d = make_pair(6.1, -33.0);
coordinates.push_back(pair1d);
coordinates.push_back(make_pair(7.45, -9.0));
coordinates.push_back(make_pair(6.1, -9.0));
coordinates.push_back(make_pair(7.45, -33.0));
coordinates.push_back(make_pair(6.1, -33.0));
//Eridanius
pair<double, double> pair2a;
pair2a = make_pair(5.1, -.3);
coordinates.push_back(pair2a);
pair<double, double> pair2b;
pair2b = make_pair(1.6, -.3);
coordinates.push_back(pair2b);
pair<double, double> pair2c;
pair2c = make_pair(5.1, -59.0);
coordinates.push_back(pair2c);
pair<double, double> pair2d;
pair2d = make_pair(1.6, -59.0);
coordinates.push_back(pair2d);
coordinates.push_back(make_pair(5.1, -0.3));
coordinates.push_back(make_pair(1.6, -0.3));
coordinates.push_back(make_pair(5.1, -59.0));
coordinates.push_back(make_pair(1.6, -59.0));
// Gemini
pair<double, double> pair3a;
pair3a = make_pair(8.1, 35.0);
coordinates.push_back(pair3a);
pair<double, double> pair3b;
pair3b = make_pair(6.1, 35.0);
coordinates.push_back(pair3b);
pair<double, double> pair3c;
pair3c = make_pair(8.1, 10.1);
coordinates.push_back(pair3c);
pair<double, double> pair3d;
pair3d = make_pair(6.1, 10.1);
coordinates.push_back(pair3d);
coordinates.push_back(make_pair(8.1, 35.0));
coordinates.push_back(make_pair(6.1, 35.0));
coordinates.push_back(make_pair(8.1, 10.1));
coordinates.push_back(make_pair(6.1, 10.1));
// Orion
pair<double, double> pair4a;
pair4a = make_pair(6.3, 25.0);
coordinates.push_back(pair4a);
pair<double, double> pair4b;
pair4b = make_pair(4.7, 25.0);
coordinates.push_back(pair4b);
pair<double, double> pair4c;
pair4c = make_pair(6.3, -10.0);
coordinates.push_back(pair4c);
pair<double, double> pair4d;
pair4d = make_pair(4.7, -10.0);
coordinates.push_back(pair4d);
coordinates.push_back(make_pair(6.3, 25.0));
coordinates.push_back(make_pair(4.7, 25.0));
coordinates.push_back(make_pair(6.3, -10.0));
coordinates.push_back(make_pair(4.7, -10.0));
// Tarus
pair<double, double> pair5a;
pair5a = make_pair(6.7, 30.0);
coordinates.push_back(pair5a);
pair<double, double> pair5b;
pair5b = make_pair(3.5, 30.0);
coordinates.push_back(pair5b);
pair<double, double> pair5c;
pair5c = make_pair(6.7, 0);
coordinates.push_back(pair5c);
pair<double, double> pair5d;
pair5d = make_pair(3.5, 0);
coordinates.push_back(pair5d);
coordinates.push_back(make_pair(6.7, 30.0));
coordinates.push_back(make_pair(3.5, 30.0));
coordinates.push_back(make_pair(6.7, 0));
coordinates.push_back(make_pair(3.5, 0));
// Bootes
pair<double, double> pair6a;
pair6a = make_pair(16.4, 53.0);
coordinates.push_back(pair6a);
pair<double, double> pair6b;
pair6b = make_pair(13.8, 53.0);
coordinates.push_back(pair6b);
pair<double, double> pair6c;
pair6c = make_pair(16.4, 7.0);
coordinates.push_back(pair6c);
pair<double, double> pair6d;
pair6d = make_pair(13.8, 7.0);
coordinates.push_back(pair6d);
coordinates.push_back(make_pair(16.4, 53.0));
coordinates.push_back(make_pair(13.8, 53.0));
coordinates.push_back(make_pair(16.4, 7.0));
coordinates.push_back(make_pair(13.8, 7.0));
// Cancer
pair<double, double> pair7a;
pair7a = make_pair(9.5, 35.0);
coordinates.push_back(pair7a);
pair<double, double> pair7b;
pair7b = make_pair(7.9, 35.0);
coordinates.push_back(pair7b);
pair<double, double> pair7c;
pair7c = make_pair(9.5, 5.0);
coordinates.push_back(pair7c);
pair<double, double> pair7d;
pair7d = make_pair(7.9, 5.0);
coordinates.push_back(pair7d);
coordinates.push_back(make_pair(9.5, 35.0));
coordinates.push_back(make_pair(7.9, 35.0));
coordinates.push_back(make_pair(9.5, 5.0));
coordinates.push_back(make_pair(7.9, 5.0));
// Leo
pair<double, double> pair8a;
pair8a = make_pair(12.1, 32.0);
coordinates.push_back(pair8a);
pair<double, double> pair8b;
pair8b = make_pair(9.5, 32.0);
coordinates.push_back(pair8b);
pair<double, double> pair8c;
pair8c = make_pair(12.1, 7.0);
coordinates.push_back(pair8c);
pair<double, double> pair8d;
pair8d = make_pair(9.5, 7.0);
coordinates.push_back(pair8d);
coordinates.push_back(make_pair(12.1, 32.0));
coordinates.push_back(make_pair(9.5, 32.0));
coordinates.push_back(make_pair(12.1, 7.0));
coordinates.push_back(make_pair(9.5, 7.0));
// Virgo
pair<double, double> pair9a;
pair9a = make_pair(15.0, 9.0);
coordinates.push_back(pair9a);
pair<double, double> pair9b;
pair9b = make_pair(12.0, 9.0);
coordinates.push_back(pair9b);
pair<double, double> pair9c;
pair9c = make_pair(15.0, -12.0);
coordinates.push_back(pair9c);
pair<double, double> pair9d;
pair9d = make_pair(12.0, -12.0);
coordinates.push_back(pair9d);
coordinates.push_back(make_pair(15.0, 9.0));
coordinates.push_back(make_pair(12.0, 9.0));
coordinates.push_back(make_pair(15.0, -12.0));
coordinates.push_back(make_pair(12.0, -12.0));
// Aquila
pair<double, double> pair10a;
pair10a = make_pair(20.3, 13.0);
coordinates.push_back(pair10a);
pair<double, double> pair10b;
pair10b = make_pair(19.0, 13.0);
coordinates.push_back(pair10b);
pair<double, double> pair10c;
pair10c = make_pair(20.3, -5.0);
coordinates.push_back(pair10c);
pair<double, double> pair10d;
pair10d = make_pair(19.0, 13.0);
coordinates.push_back(pair10d);
coordinates.push_back(make_pair(20.3, 13.0));
coordinates.push_back(make_pair(19.0, 13.0));
coordinates.push_back(make_pair(20.3, -5.0));
coordinates.push_back(make_pair(19.0, -5.0));
// Sagitarius
pair<double, double> pair11a;
pair11a = make_pair(20.0, -20.0);
coordinates.push_back(pair11a);
pair<double, double> pair11b;
pair11b = make_pair(18.0, -20.0);
coordinates.push_back(pair11b);
pair<double, double> pair11c;
pair11c = make_pair(20.0, -44.4);
coordinates.push_back(pair11c);
pair<double, double> pair11d;
pair11d = make_pair(18.0, -44.4);
coordinates.push_back(pair11d);
coordinates.push_back(make_pair(20.0, -20.0));
coordinates.push_back(make_pair(18.0, -20.0));
coordinates.push_back(make_pair(20.0, -44.4));
coordinates.push_back(make_pair(18.0, -44.4));
// Scorpius
pair<double, double> pair12a;
pair12a = make_pair(18.0, -21.1);
coordinates.push_back(pair12a);
pair<double, double> pair12b;
pair12b = make_pair(16.0, -21.0);
coordinates.push_back(pair12b);
pair<double, double> pair12c;
pair12c = make_pair(18.0, -42.0);
coordinates.push_back(pair12c);
pair<double, double> pair12d;
pair12d = make_pair(16.0, -42.0);
coordinates.push_back(pair12d);
coordinates.push_back(make_pair(18.0, -21.1));
coordinates.push_back(make_pair(16.0, -21.0));
coordinates.push_back(make_pair(18.0, -42.0));
coordinates.push_back(make_pair(16.0, -42.0));
// Capricornus
pair<double, double> pair13a;
pair13a = make_pair(21.8, -12.0);
coordinates.push_back(pair13a);
pair<double, double> pair13b;
pair13b = make_pair(20.3, -12.0);
coordinates.push_back(pair13b);
pair<double, double> pair13c;
pair13c = make_pair(21.8, -28.0);
coordinates.push_back(pair13c);
pair<double, double> pair13d;
pair13d = make_pair(20.3, -28.0);
coordinates.push_back(pair13d);
coordinates.push_back(make_pair(21.8, -12.0));
coordinates.push_back(make_pair(20.3, -12.0));