can anyone tell me how to fix this, it needs to print out the calendar for a whole year.

#include<iostream>
#include<iomanip>
int startDay(int year, int calcjan1);
int calcjan1(int year);
void printMonth (int startDay, int days);
int main()
  
  {
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        startDay = calcjan1(year); 
                     
         for(int month = 1;month<= 12; month++)
            days = daysinmonth(month)
            
            printtitle(monthnum,year)
            
            printmonth(startDay,days)
            startDay = (startDay + days)%7
            
            cout<<"Would you like to enter another year?: Y to continue";
            cin>>Y;
            
        }while (again='Y')  
        
        
 //====================calcjan1===================
 //calculates the first day of Jan. for year entered
 int calcjan1(int year)
{
    year = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7
    
    return year; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
     system("Pause");
     return;
}

Edited 6 Years Ago by Nick Evan: n/a

Use [code] [/code] tags.

The reason you're getting a whole bunch of errors when you try to cout is that you've neglected to place using namespace std; after including iostream:

#include<iostream>

#include<iomanip>

int startDay(int year, int calcjan1);

And here:

startDay = calcjan1(year);

You can't just give parameters to a function using the = sign. C++ just wasn't designed for that. Use something like this instead:

startDay(year, calcjan1(year));
days = daysinmonth(month)

1. You never declared the variable "days"
2. You never declared daysinmonth .
3. Missing semicolon at the end of the statement.

for(int month = 1;month<= 12; month++)

days = daysinmonth(month)
printtitle(monthnum,year)
printmonth(startDay,days)

startDay = (startDay + days)%7

- Your loop needs braces to show where the code that's supposed to loop starts and stops.
- None of these statements end in semicolons, which is required.
- printtitle was never declared
- The 'm' in "printmonth" is not captalized. Remember, C++ is a case-sensitive language.

Note that you probably want a newline character (\n) at the end of the sentance:

cout<<"Would you like to enter another year?: Y to continue";

Here, you probably want this instead:

cin>>again;

Missing semicolon and closing brace for main :

}while (again='Y')

(and while should have == instead of =)

Here, you never finished the expression after the + (and this line is also missing a semicolon):
year = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7
*code tags omitted for coloring*

Hope this helps

ok this is what i have now but there are a couple problems when i go to compile it. that i cant figure out.

#include<iostream>
#include<iomanip>
using namespace std;
int startDay(int year, int calcjan1);
int calcjan1(int year,int jan);
void printMonth (int startDay, int days);
int days;
int daysinmonth(int month, int year);
void printtitle(int monthnum, int year);
int monthnum;
int main()
{
    int jan=0;
    char y;
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        int startDay =  calcjan1(int year); 
                     
         for(int month = 1;month<= 12; month++);
           {
             int days = daysinmonth(int month);
            
             printtitle(monthnum,year);
            
             printMonth(startDay,days);
             startDay = (startDay + days)%7;
            }
            cout<<"Would you like to enter another year?: Hit y to continue";
            cin>>y;
            
        }while (again=='y');  
        system("Pause");
        return 0;
}
        
 //====================calcjan1===================
 //calculates the first day of Jan. for year entered
 int calcjan1(int year, int jan)
{
    
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7;
    
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
    
     return;
}           
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
  {
     switch(monthnum)
        {
           case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
           case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
           case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
           case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
           case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
           case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
           case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
           case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
           case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
           case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
           case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
           case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
        }  
        return;
}//printtitle

//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
      {  
         case 4:case 6:case 9:case 11:  return 30;
            break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12:  return 31;
            break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
                    return 28;
                 else 
                    return 29;
            break;
      }
   return 0;
}//daysinmonth

Edited 6 Years Ago by Nick Evan: n/a

int startDay = calcjan1(int year);

I think you meant the following, as you can't just make a new variable like that:

int startDay = calcjan1(year);
for(int month = 1;month<= 12; month++);

You don't need a semicolon to end the for statement.

int days = daysinmonth(int month);

Same problem as before; you probably want this:

int days = daysinmonth(month);
jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7;

In this one, you've got ...400))+) so you've got a + and didn't add anything to it.

Ok i fixed all of that but get a compiling error at these points lines

6 C:\Documents and Settings\menu_jrs.cpp too few arguments to function `int calcjan1(int, int, int)'

24 C:\Documents and Settings\menu_jrs.cpp at this point in file

9 C:\Documents and Settings\menu_jrs.cpp too few arguments to function `int daysinmonth(int, int, int)'

28 C:\Documents and Settings\menu_jrs.cpp at this point in file

#include<iostream>
#include<iomanip>
using namespace std;
int startDay(int year, int calcjan1);
int calcjan1(int year,int jan,int startday);
void printMonth (int startDay, int days);
int days;
int daysinmonth(int month, int year,int days);
void printtitle(int monthnum, int year);
int monthnum;
int main()
{
    int jan=0;
    char y;
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        int startDay =  calcjan1(year); 
                     
         for(int month = 1;month<= 12; month++)
           {
             int days = daysinmonth(month);
            
             printtitle(monthnum,year);
            
             printMonth(startDay,days);
             startDay = (startDay + days)%7;
            }
            cout<<"Would you like to enter another year?: Hit y to continue";
            cin>>y;
            
        }while (again=='y');  
        system("Pause");
        return 0;
}
        
//====================calcjan1===================
//calculates the first day of Jan. for year entered
 int calcjan1(int year, int jan)
{
    
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+1)%7;
    
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
    
     return;
}           
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
  {
     switch(monthnum)
        {
           case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
           case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
           case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
           case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
           case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
           case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
           case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
           case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
           case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
           case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
           case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
           case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
        }  
        return;
}//printtitle

//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
      {  
         case 4:case 6:case 9:case 11:  return 30;
            break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12:  return 31;
            break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
                    return 28;
                 else 
                    return 29;
            break;
      }
   return 0;
}//daysinmonth

Edited 6 Years Ago by Nick Evan: n/a

PLEASE, use code tags.

int calcjan1(int year,int jan,int startday);
 
 
int startDay = calcjan1(year);

That's the problem, you declare a function wich will take 3 parameters, but when you call it, you just pass 1. Same problem with:

int days = daysinmonth(month);

ok show me exactly how it would look i dont know if i quite understand.

#include<iostream>
#include<iomanip>
using namespace std;
int startDay(int year, int calcjan1);
int calcjan1(int year);
void printMonth (int startDay, int days);
int days(int daysinmonth,int month, int year);
int daysinmonth(int month, int year);
void printtitle(int monthnum, int year);
int monthnum;
int main()
{
    int jan=0;
    char y;
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        int startDay =  calcjan1(year); 
                     
         for(int month = 1;month<= 12; month++);
           {
            int days = daysinmonth( month,year);
            
             printtitle(monthnum,year);
            
             printMonth(startDay,days);
             startDay = (startDay + days)%7;
            }
            cout<<"Would you like to enter another year?: Hit y to continue";
            cin>>y;
            
        }while (again=='y');  
        system("Pause");
        return 0;
}
        
 //====================calcjan1===================
 //calculates the first day of Jan. for year entered
 int calcjan1(int year, int jan)
{
    
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7;
    
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
    
     return;
}           
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
  {
     switch(monthnum)
        {
           case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
           case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
           case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
           case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
           case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
           case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
           case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
           case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
           case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
           case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
           case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
           case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
        }  
        return;
}//printtitle

//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
      {  
         case 4:case 6:case 9:case 11:  return 30;
            break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12:  return 31;
            break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
                    return 28;
                 else 
                    return 29;
            break;
      }
   return 0;
}//daysinmonth

Edited 6 Years Ago by Nick Evan: n/a

ok show me exactly how it would look i dont know if i quite understand.

Well to use code tags you just press this button: :cheesy:
[IMG]http://thefailures.nl/school/code.jpg[/IMG]


and for your other problem: I see you have adjusted your functions and you are getting another error. This is because of this line:

for(int month = 1;month<= 12; month++);

You can remove the word ' int ' and add

int month = 0;

with the rest of your declarations (just below int main(){ )

The other error is because of this line:

jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7;

You can't add a ')' to a number

Edited 6 Years Ago by Nick Evan: n/a

And you still have a problem with your declarations:
change this:

int startDay(int year, int calcjan1);
int calcjan1(int );
void printMonth (int startDay, int days);
int days(int daysinmonth,int month, int year);
int daysinmonth(int month, int year);
void printtitle(int monthnum, int year);

into this

int startDay(int , int );
int calcjan1(int, int );
void printMonth (int , int );
int days(int ,int , int );
int daysinmonth(int , int );
void printtitle(int , int );

ctrl-c ctrl-v
then change the line:

int startDay = calcjan1(year);

into:

int startDay = calcjan1(year, jan);

And your program will at least run, now comes the time for debugging...

Edited 6 Years Ago by Nick Evan: n/a

Ok i did that but now i get a linker error..sry i didnt put it in code tags

#include<iostream>
#include<iomanip>
using namespace std;
int startDay(int year, int calcjan1);
int calcjan1(int year);
void printMonth (int startDay, int days);
int days(int daysinmonth,int month, int year);
int daysinmonth(int month, int year);
void printtitle(int monthnum, int year);
int monthnum;
int main()
{
    int jan=0;
    char y;
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        int startDay =  calcjan1(year); 
                     
         for(int month = 1;month<= 12; month++);
           {
            int days = daysinmonth( month,year);
            
             printtitle(monthnum,year);
            
             printMonth(startDay,days);
             startDay = (startDay + days)%7;
            }
            cout<<"Would you like to enter another year?: Hit y to continue";
            cin>>y;
            
        }while (again=='y');  
        system("Pause");
        return 0;
}
        
 //====================calcjan1===================
 //calculates the first day of Jan. for year entered
 int calcjan1(int year, int jan)
{
    
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+)%7;
    
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
    
     return;
}           
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
  {
     switch(monthnum)
        {
           case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
           case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
           case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
           case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
           case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
           case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
           case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
           case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
           case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
           case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
           case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
           case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
        }  
        return;
}//printtitle

//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
      {  
         case 4:case 6:case 9:case 11:  return 30;
            break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12:  return 31;
            break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
                    return 28;
                 else 
                    return 29;
            break;
      }
   return 0;
}//daysinmonth

Edited 6 Years Ago by Nick Evan: n/a

sry i didnt put it in code tags

Was it to difficult to just select the text and press the button i mentioned?

Now for the linker error: I allready solved it in my previous post, but here's your code that will compile. I'm not saying it'll work, because it won't, but that's where you come in!

#include<iostream>
#include<iomanip>
usingnamespace std;
int startDay(int , int );
int calcjan1(int, int );
void printMonth (int , int );
int days(int ,int , int );
int daysinmonth(int , int );
void printtitle(int , int );
int monthnum;
int main()
{
int jan=0;
char y;
char again;
int year=0; 
int month = 1;
do
{
    cout<<"Enter a year for a calendar you would like to view:";
    cin>>year; 
   int startDay = calcjan1(year, jan); 
   for(month = 1;month<= 12; month++);
    {
        int days = daysinmonth( month,year);
         printtitle(monthnum,year);
         printMonth(startDay,days);
         startDay = (startDay + days)%7;
     }
     cout<<"Would you like to enter another year?: Hit y to continue";
     cin>>y;
}
while (again=='y'); 
 
system("Pause");
return 0;
}
//====================calcjan1===================
//calculates the first day of Jan. for year entered
int calcjan1(int year, int jan)
{
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+1)%7;
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
    for(int skipDay = 0;skipDay < startDay; skipDay++)
          cout<<" ";
    int weekDay = startDay;
    for (int dayCount =1; dayCount <=days; dayCount++)
     {
         if (weekDay>6)
          {
               cout<<endl;
               weekDay =1; 
          }
         else 
               weekDay++;
          cout<<setw(3) <<dayCount<<" ";
      } 
     cout<<"\n--- --- --- --- --- --- ---\n";
    return;
} 
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
{
    switch(monthnum)
     {
         case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
         case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
         case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
         case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
         case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
         case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
         case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
         case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
         case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
         case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
         case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
         case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
          } 
         return;
}//printtitle
//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
     { 
         case 4:case 6:case 9:case 11: return 30;
              break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12: return 31;
              break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
              return 28;
         else 
              return 29;
         break;
}
return 0;
}//daysinmonth

now this is what i have and still got a problem

#include<iostream>
#include<iomanip>
using namespace std;
int startDay(int , int );
int calcjan1(int, int );
void printMonth (int , int );
int days(int ,int , int );
int daysinmonth(int , int );
void printtitle(int , int );
int monthnum(int);
int main()
{
    int month=0;
    int jan=0;
    char y;
    char again;
    int year=0;      
    do
      {
        cout<<"Enter a year for a calendar you would like to view:";
        cin>>year;       
                     
        int startDay =  calcjan1(year,jan); 
                     
         for(month = 1;month<= 12; month++);
           {
            int days = daysinmonth( month,year);
            
             printtitle(monthnum,year);
            
             printMonth(startDay,days);
             startDay = (startDay + days)%7;
            }
            cout<<"Would you like to enter another year?: Hit y to continue";
            cin>>y;
            
        }while (again=='y');  
        system("Pause");
        return 0;
}
        
 //====================calcjan1===================
 //calculates the first day of Jan. for year entered
 int calcjan1(int year, int jan)
{
    
     jan = ((year-1)*365+((year-1)/4)-((year-1)/100)+(((year-1)/400))+1)%7;
    
    return jan; 
}//calcjan1
//===============printMonth==============
void printMonth (int startDay, int days)
{
     cout<<"Sun Mon Tue Wed Thu Fri Sat\n";
     cout<<"--- --- --- --- --- --- ---\n";
   
     for(int skipDay = 0;skipDay < startDay; skipDay++)
        cout<<"    ";
        
     int weekDay = startDay;
     for (int dayCount =1; dayCount <=days; dayCount++)
         {
              if (weekDay>6)
                 {
                    cout<<endl;
                    weekDay =1; 
                 }
                 
              else 
                 weekDay++;
              cout<<setw(3) <<dayCount<<" ";
         } 
         
     cout<<"\n--- --- --- --- --- --- ---\n";
    
     return;
}           
//===================printtitle==================
//print the month name & year
void printtitle(int monthnum,int year)
  {
     switch(monthnum)
        {
           case 1: cout<<"January"<<setw(15)<<year<<endl;
              break;
           case 2: cout<<"February"<<setw(15)<<year<<endl;
              break;
           case 3: cout<<"March"<<setw(15)<<year<<endl;
              break;
           case 4: cout<<"April"<<setw(15)<<year<<endl;
              break;
           case 5: cout<<"May"<<setw(15)<<year<<endl;
              break;
           case 6: cout<<"June"<<setw(15)<<year<<endl;
              break;
           case 7: cout<<"July"<<setw(15)<<year<<endl;
              break;
           case 8: cout<<"August"<<setw(15)<<year<<endl;
              break;
           case 9: cout<<"September"<<setw(15)<<year<<endl;
              break;
           case 10: cout<<"October"<<setw(15)<<year<<endl;
              break;
           case 11: cout<<"November"<<setw(15)<<year<<endl;
              break;
           case 12: cout<<"December"<<setw(15)<<year<<endl;
              break;
        }  
        return;
}//printtitle

//========================daysinmonth===================
//checks for leap year
int daysinmonth(int month,int year)
{ 
    switch(month)
      {  
         case 4:case 6:case 9:case 11:  return 30;
            break;
         case 1:case 3:case 5:case 7:case 8:case 10:case 12:  return 31;
            break;
         case 2: if((!(year % 4) && (year % 100) || !(year % 400)))
                    return 28;
                 else 
                    return 29;
            break;
      }
   return 0;
}//daysinmonth

Look, just copy - paste the code i've posted and USE CODE TAGS in your replies. it is impossible to read.


[edit]

Disregar this last post

ok, didn't read that one in time ;)
[/edit]

Edited 6 Years Ago by Nick Evan: n/a

This question has already been answered. Start a new discussion instead.