I Dont understand the error.....

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;
}
You're missing an opening curly brace { after that line.
i have it, still showing the same error
closed account (3hM2Nwbp)
Compiler wrote:

In function int main()
to few arguments to function 'int getdaysInMonth{int,int}'
at this point in file


Translation wrote:

In the main function, too few arguments were provided to the called method 'int getDaysInMonth(int, int)


(Show us the main function, please.)
Last edited on
int main(){

int year(0);
int theMonth(0);
int days(0);
string nameMonth("");


instructions();
while (true){
year = getYear();

theMonth = getMonth();

days = getdaysInMonth();

return( year, theMonth, days ) ;
}

system("Pause");
return 0;

}
closed account (3hM2Nwbp)
Using code tags is helpful to us as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}
Last edited on
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;
}
Topic archived. No new replies allowed.