Question: #include #include using namespace std; bool isLeapYear ( int year ) { return ( year % 4 = = 0 && year % 1 0
#include
#include
using namespace std;
bool isLeapYearint year
return year && year year ;
int daysInMonthint month, int year
if month
return isLeapYearyear : ;
return month month month month : ;
int daysInYearint year, int month, int day
int days ;
for int m ; m month; m
days daysInMonthm year;
days day;
return days;
int dayValueint year, int month, int day
int totalDays ;
for int y ; y year; y
totalDays isLeapYeary : ;
totalDays daysInYearyear month, day;
return totalDays;
string dayOfWeekint dayValue
string daysMonday "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday";
return daysdayValue ;
int main
ifstream inputFiledatestxt;
string line;
while getlineinputFile line
int month, day, year;
sscanflinecstrddd &month, &day, &year; Assuming the input format is MMDDYYYY
int value dayValueyear month, day;
string dayName dayOfWeekvalue;
bool leapYear isLeapYearyear;
cout dayName month day year has a day value of value
leapYear and is a leap year." : and is not a leap year." endl;
inputFile.close;
return ;
The code outputs the day as "wednesday" no matter what date I plug into my input file, I put today's date which is a tuesday and it says wednesday"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
