I'm having a problem being cause by what I believe to be my getMonthValue function which is resulting in my output always being "Saturday." Can anyone give me any reason this is happening? Thanks.

#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);
void getInput (int day, int month, int year);

int main()
{ 
 int month, day, year, century, decade, weekday, leap_year, mvalue;
 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 + mvalue + decade + century)%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 (weekday == 6);
	 day_week = "Saturday";
   cout << month << "/" << day << "/" << year << " falls on a " << day_week << endl;
    }while (ans == 'y' || ans == 'Y');
return 0;
}
    bool isLeapYear(int year)
      {
      int temp1, temp2, temp3;
      temp1 = year;
      temp2 = year;
      temp3 = year;
      temp1 = year % 400;
      temp2 = year % 4;
      temp3 = year % 100;
      if (temp1 == 0)
	return (true);
      else if (temp2 == 0 && temp3 > 0)
	return (true);
      else
	return (false);
      }	
    int getCenturyValue(int year)
      {
      int century, remainder;
      century = year/100;
      remainder = (3-(century % 4));
      remainder = remainder * 2;
      return (remainder);
      }
    int getYearValue(int year)
      {
      int decade;
      decade = year%100;
      decade = (decade/4) + decade;
      return (decade);
      }
    int getMonthValue(int month, int year)
      {
      int month
      if (month == 1){
	if (isLeapYear(year))
	  month = 6;
	return (month);
	else 
	  month = 0;
	return (month);}
      else if (month == 2){
	if (isLeapYear(year))
	  month = 2;
	else
	  month = 3;
	return (month);}
      else if (month == 10){
	month = 0;
	return (month);}
      else if (month == 3 || month == 11){
	month = 3;
	return (month);}
      else if (month == 4 || month == 7){
	month = 6;
	return (month);}
      else if (month == 5){
	month = 1;
	return (month);}
      else if (month == 6){
	month = 4;
	return (month);}
      else if (month == 8){
	month = 2;
	return (month);}
      else (month == 9 || month == 12);{
	month = 5;
	return (month);}
      }
#include <iostream>
#include <string>
#include <conio>
using namespace std;

bool isLeapYear (int year);
int getCenturyValue (int year);
int getYearValue (int year);
int getMonthValue (int month, int year);
void getInput (int day, int month, int year);

int main()
{
 int month, day, year, century, decade, weekday, leap_year, mvalue;
 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 + mvalue + decade + century)%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 (weekday == 6);
     day_week = "Saturday"; */
    switch(weekday){case 0:day_week = "Sunday";break;
    case 1:day_week = "Monday";break;
    case 2:day_week="Tuesday";break;
    case 3:day_week="Wednesday";break;
    case 4:day_week="Thursday";break;
    case 5:day_week="Friday";break;
    default:day_week="Saturday";}
   cout << month << "/" << day << "/" << year << " falls on a " << day_week << endl;
    }while (ans == 'y' || ans == 'Y');
//return 0;
getch();
}
    bool isLeapYear(int year)
      {
      int temp1, temp2, temp3;
      temp1 = year;
      temp2 = year;
      temp3 = year;
      temp1 = year % 400;
      temp2 = year % 4;
      temp3 = year % 100;
      if (temp1 == 0)
    return (true);
      else if (temp2 == 0 && temp3 > 0)
    return (true);
      else
    return (false);
      } 
    int getCenturyValue(int year)
      {
      int century, remainder;
      century = year/100;
      remainder = (3-(century % 4));
      remainder = remainder * 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 (month == 1){
    if (isLeapYear(year))
     { month = 6;
    return (month);}
    else
      {month = 0;
    return (month);}}
      else if (month == 2){
    if (isLeapYear(year))
      month = 2;
    else
      month = 3;
    return (month);}
      else if (month == 10){
    month = 0;
    return (month);}
      else if (month == 3 || month == 11){
    month = 3;
    return (month);}
      else if (month == 4 || month == 7){
    month = 6;
    return (month);}
      else if (month == 5){
    month = 1;
    return (month);}
      else if (month == 6){
    month = 4;
    return (month);}
      else if (month == 8){
    month = 2;
    return (month);}
      else (month == 9 || month == 12);{
    month = 5;
    return (month);}
      }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.