C++ program to create a console application that allows the user to access sunrise/sunset almanac da

Feb 3rd, 2012
Studypool Tutor
Price: $20 USD

Tutor description

Write a program to create a console application that allows the user to access sunrise/sunset almanac data for up to 30 days for a given choice of cities. Read the data from the file cityinfo.txt into one or more arrays. This will be the set of cities the use can choose from. Your program should first prompt the user for a city airport code (such as MBS). If information is not available for this city, provide feedback to the user and terminate the program. If this city is in the list of available cities, access the geographical coordinates (latitude, longitude) and time zone code (E-eastern, C-central, M-mountain, P-pacific). If the city code is valid and in the list, next prompt the user for a calendar date in a coded form of such as 20130831 (for August 31, 2013). If the date is invalid, inform the user. Do not allow them to continue until they have entered a valid date. Next, prompt the user for a number of days to write. This value must be in the range 1 and 30. An error message sh

Word Count: 3277
Showing Page: 1/40
CPP Sunrise Sunset Alamac DataContentsMain.cpp// CPPSunRiseSetAlmanac.cpp : Defines the entry point for the console application.//#include "city.h"#include "sun.h"#include "datefun.h"#include "ReadFile.h"#include "Text.h"#include "Keyboard.h"#include #include #include #include #include #include using namespace std;string Month[12] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT","NOV","DEC"};vector read_city_info() {vector vCityInfo;String* line= createString(""); ReadFile* f_cityinfo = createReadFile("cityinfo.txt"); int line_no = 0;while(!eof(f_cityinfo)){ line = append(readLine(f_cityinfo), line); ++line_no; if (line_no % 2 == 0){ city oCity(line); vCityInfo.push_back(oCity); destroyString(line); line = createString(""); }} close(f_cityinfo); return vCityInfo;}struct tm* getDate(int month, int day, int year){ time_t rawtime; time(&rawtime);struct tm* tm_ptr = localtime(&rawtime);if (tm_ptr){tm_ptr->tm_year = year-1900;tm_ptr->tm_mon = month-1;tm_ptr->tm_mday = day;mktime(tm_ptr);}return tm_ptr;}struct tm* incrementDate(struct tm* sDate){ time_t rawtime = mktime(sDate); struct tm* tm_ptr = localtime(&rawtime);if (tm_ptr){tm_ptr->tm_mday += 1;mktime(tm_ptr);}return tm_ptr;}bool considerDaylightSavin

Review from student

Studypool Student
" Excellent work as usual "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors