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);
      }
}

Well basically I'm running into problems compiling in lines 25, and 46. I could use a hand identifying why these problems are occurring.

Well you have this in your code at line 25

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);

Your calling functions without passing any values to them....i.e.
getMonthValue requires that you pass two integers to it like

int value1;
int value2;

getMonthValue(value1, value2);

Line 46 is an open curly brace...Are you sure your braces matched?

Edited 6 Years Ago by gerard4143: n/a

Ok I basically have this figure out now, I'm just having some trouble implementing one final thing. If you look over the code, I think you'll be able to see what I'm trying to do. The lines of interest are 79 and 82. Thanks again.

#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, leap_year;
 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 + month + decade + century) + 7*((day + month + 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 if (weekday = 6)
	 day_week = "Saturday";
	else (weekday = 7);
	 day_week = "Sunday";
   cout << day << "/" << month << "/" << year << " falls on a " << day_week;
    } 
  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 - (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 (isLeapYear(int year) = "true" && month == 1)
	month = 6;
	return (month);
      else if (isLeapYear(int year) = "true" && month == 2)
	month = 2;
	return (month);
      else if (month == 1 || month == 10)
	month = 0;
	return (month);
      else if (month == 2 || 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);
      }
This article has been dead for over six months. Start a new discussion instead.