Commit 3bffcb12 authored by Brandon Reid's avatar Brandon Reid
Browse files

autosave

parent 4d66494b
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
using namespace std; using namespace std;
// Input checking functions // Input checking functions
int yearPrompt (int year) { int yearPrompt () { // empty argument
int year = 0;
do { do {
cout << "Enter year: "; cout << "Enter year: ";
if (!(cin >> year)) { // validates that numbers were entered and checks input if (!(cin >> year)) { // validates that numbers were entered and checks input
...@@ -31,7 +32,8 @@ int yearPrompt (int year) { ...@@ -31,7 +32,8 @@ int yearPrompt (int year) {
} while (true); } while (true);
} }
string monthPrompt (string month) { string monthPrompt () {
string month;
do { do {
cout << "Enter month: "; cout << "Enter month: ";
cin >> month; cin >> month;
...@@ -43,7 +45,8 @@ string monthPrompt (string month) { ...@@ -43,7 +45,8 @@ string monthPrompt (string month) {
} while (true); } while (true);
} }
int dayPrompt (string month, int day, int year) { int dayPrompt (string month, int year) {
int day = 0;
do { do {
cout << "Enter day: "; cout << "Enter day: ";
if (!(cin >> day)) { // validates that numbers were entered and checks input if (!(cin >> day)) { // validates that numbers were entered and checks input
...@@ -77,7 +80,8 @@ int dayPrompt (string month, int day, int year) { ...@@ -77,7 +80,8 @@ int dayPrompt (string month, int day, int year) {
} while (true); } while (true);
} }
int hourPrompt (int hour) { int hourPrompt () {
int hour = 0;
do { do {
cout << "Enter hour (0 - 23): "; cout << "Enter hour (0 - 23): ";
if (!(cin >> hour)) { // validates that numbers were entered and checks input if (!(cin >> hour)) { // validates that numbers were entered and checks input
...@@ -94,7 +98,8 @@ int hourPrompt (int hour) { ...@@ -94,7 +98,8 @@ int hourPrompt (int hour) {
} while (true); } while (true);
} }
int minutePrompt (int minute) { int minutePrompt () {
int minute = 0;
do { do {
cout << "Enter minute: "; cout << "Enter minute: ";
if (!(cin >> minute)) { // validates that numbers were entered and checks input if (!(cin >> minute)) { // validates that numbers were entered and checks input
...@@ -111,10 +116,11 @@ int minutePrompt (int minute) { ...@@ -111,10 +116,11 @@ int minutePrompt (int minute) {
} while (true); } while (true);
} }
pair<double,double> altAndAziPair (double altitude, string direction) { pair<double,double> altAndAziPair () {
double altitude = 0;
double Azi; double Azi;
string direction;
pair<double,double> aziPair; pair<double,double> aziPair;
do { do {
cout << "Enter the altitude at which you are looking (0-90): "; cout << "Enter the altitude at which you are looking (0-90): ";
if (!(cin >> altitude)) { // validates that numbers were entered and checks input if (!(cin >> altitude)) { // validates that numbers were entered and checks input
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
using namespace std; using namespace std;
int yearPrompt (int year); int yearPrompt ();
string monthPrompt (string month); string monthPrompt ();
int dayPrompt (string month, int day, int year); int dayPrompt (string month, int year);
int hourPrompt (int hour); int hourPrompt ();
int minutePrompt (int minute); int minutePrompt ();
double dateToHour (string month, int day, int hour, int minute); double dateToHour (string month, int day, int hour, int minute);
pair<double,double> altAndAziPair (double altitude, string direction); pair<double,double> altAndAziPair ();
bool isLeap (int year); bool isLeap (int year);
...@@ -9,32 +9,25 @@ using namespace std; ...@@ -9,32 +9,25 @@ using namespace std;
int main () { int main () {
//variables //variables
string monthInput; string monthInput;
string input3;
string input7;
int monthDay = 0; int monthDay = 0;
int yearInput = 0; int yearInput = 0;
int hourInput = 0; int hourInput = 0;
int minuteInput = 0; int minuteInput = 0;
int input1 = 0;
int input2 = 0;
int input4 = 0;
int input5 = 0;
double input6;
pair <double,double> testPair; pair <double,double> testPair;
cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl; cout << "==============Welcome to the Star-Gazer v 1.0==============" << endl;
do { do {
yearInput = yearPrompt(input1); yearInput = yearPrompt();
monthInput = monthPrompt(input3); monthInput = monthPrompt();
monthDay = dayPrompt(monthInput, input2, yearInput); monthDay = dayPrompt(monthInput, yearInput);
hourInput = hourPrompt(input4); hourInput = hourPrompt();
minuteInput = minutePrompt(input5); minuteInput = minutePrompt();
testPair = altAndAziPair (input6, input7); testPair = altAndAziPair ();
} while (false); } while (false);
//cout << dateToHour(yearInput, monthInput, monthDay, hourInput, minuteInput) << endl; //cout << dateToHour(yearInput, monthInput, monthDay, hourInput, minuteInput) << endl;
......
Supports Markdown
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