# Calender

• 02-03-2003
sameintheend01
Calender
Ok, I'm sure everyone is sick of this one. I have to make a calender. Problem is that it has to be able to print from the year 0 until the year 10,000 so Zeller is no help for me. I think i am having problems in the function that does the for loop. Advice Please! thanks:

#include <iostream>
#include <cmath>

using namespace std;

int whatDay(int day)
{

if (day%7==0){
cout<<"TheCOunter"<<day<<endl;
return(7);}
if (day%6==0){
cout<<"TheCOunter"<<day<<endl;
return(6);}
if (day%5==0){
cout<<"TheCOunter"<<day<<endl;
return(5);}
if (day%4==0){
cout<<"TheCOunter"<<day<<endl;
return(4);}
if (day%3==0){
cout<<"TheCOunter"<<day<<endl;
return(3);}
if (day%2==0){
cout<<"TheCOunter"<<day<<endl;
return(2);}
if (day%1==0){
cout<<"TheCOunter"<<day<<endl;
return (1);}
}

int isLeap(int year1)
{
int dayInMonth=28;

if (year1%4==0){
dayInMonth=29;
if (year1%100==0){
dayInMonth=28;
if (year1%400==0)
dayInMonth=29;}}

return (dayInMonth);
}

int firstDay(int calenderYear)
{
long counter=0;
int theCounter=0;

for(int year=0;year<calenderYear;year++){
if (year == 0)
counter=theCounter+331+isLeap(year);
else
counter=theCounter+337+isLeap(year);
theCounter+=whatDay(counter);
//counter=1;
//cout<<counter<<endl;
}
//theCounter--;
return (whatDay(theCounter));

}

int main(void)
{

int dayInMonth=0,calenderYear1=0 ;
int x=0;

cout<<"hello"<<endl;
cin>> calenderYear1;

cout<<"The first day is "<<firstDay(calenderYear1)<<endl;
cout<<calenderYear1<<endl;
return(0);
}
• 02-03-2003
registereduser
needs code tags, then i'll read it