Guys im trying to make a valid calendar, i got the month and the year done, but when i did the days, and when i compile there is only one error thats appearing:
The error is
In funtion int main()
to few arguments to funtion 'int getdaysInMonth{int,int}'
at this point in file
I dont know whats wrong or what does it mean?
int getdaysInMonth( int theMonth, int year) <- its appearing on this line
int number(0);
while( true ) {
if (theMonth == 2)
number = 28;
if (isLeap2(year) == true)
number = 29;
else if (theMonth == 9 || theMonth == 4 || theMonth == 6 || theMonth == 11)
number = 30;
else
number = 31;
}
return number;
}
int main()
{
int year(0);
int theMonth(0);
int days(0);
string nameMonth("");
instructions();
while (true)
{
year = getYear();
theMonth = getMonth();
// days = getdaysInMonth(); // <-- This line, getdaysInMonth takes 2 parameters, month and year
days = getdaysInMonth(theMonth, year); // <-- Passing proper values
// return( year, theMonth, days ) ; // <-- Also, this line shouldn't compile.
// What exactly do you want to return?
}
return 0;
}
Im trying make calender that is valid troughout, and its not working? febuary only has 29 0r 28 days and when I put in 30 for days for month 2, it should not allow me to do that, but instead it says there are 30 days in February. Month and the year are working perfectly fine??? help please ?why this function is not working???
int getdaysInMonth( int theMonth, int year){
int days(0);
while ( days < 1 || days > 31 ) {
if (theMonth == 2)
days = daysInFebruary(year);
else if (theMonth == 9 || theMonth == 4 || theMonth == 6 || theMonth == 11)
days = 30;
else
days = 31;
cout << "Enter a day in a month ( integer between 1....31)" ;
cin >> days;
}
return days;
}