I'm having a few issues with my code and trying to figure out the last problems with it. It would be a great help if someone could look this over and guide me in the right direction. This program is basically supposed to take the entered date, and tell you what day it was on that date.
#include <iostream>
#include <string>
using namespace std;
bool isLeapYear (int year);
int getCenturyValue (int year);
int getYearValue (int year);
int getMonthValue (int month, int year);
int main()
{
int month, day, year, century, decade, weekday;
char ans;
string day_week;
do
{
cout << " Enter month day and the year: ";
cin >> month;
cin >> day;
cin >> year;
bool isLeapYear (int year);
int getCenturyValue(int year);
int getYearValue (int year);
int getMonthValue(int month, int year);
weekday = (day + getMonthValue + getYearValue + getCenturyValue) + 7*((day + getMonthValue + getYearValue + getCenturyValue)/7);
if (weekday = 0)
day_week = "Sunday";
else if (weekday = 1)
day_week = "Monday";
else if (weekday = 2)
day_week = "Tuesday";
else if (weekday = 3)
day_week = "Wednesday";
else if (weekday = 4)
day_week = "Thursday";
else if (weekday = 5)
day_week = "Friday";
else if (weekday = 6)
day_week = "Saturday";
else if (weekday = 7)
day_week = "Sunday";
cout << day << "/" << month << "/" << year << " falls on a " << day_week;
}
while (ans == 'y' || ans == 'Y');
}
{
bool isLeapYear(int year)
{
if (leap_year = ((year % 400 = 0) || (year % 4 =0 && year % 100 != 0)));
{
return true;
}else{
return false;
}
}
int getCenturyValue(int year)
{
int century, remainder;
century = year/100;
remainder = (3-(century - (century/4)))*2;
return (remainder);
}
int getYearValue(int year)
{
int decade;
decade = year%100;
decade = (decade/4) + decade;
return (decade);
}
int getMonthValue(int month, int year)
{
if (bool isLeapYear == "true" && month = 1)
return (6);
else if (bool isLeapYear == "true" && month = 2)
return (2);
else if (month = 1 || month = 10)
return (0);
else if (month = 2 || month = 3 || month = 11)
return (3);
else if (month = 4 || month = 7)
return (6);
else if (month = 5)
return (1);
else if (month = 6)
return (4);
else if (month = 8)
return (2);
else if (month = 9 || month = 12)
return (5);
}
}