CSE TP By: Sudhanshu
CSE TP By: Sudhanshu
DOA: 09/01/2010
DOS: 11/08/2010
Topic: Calendar
Sudhanshu Mishra
B. Tech (ECE 3rd Sem.)
Content:
• Introduction
• Calendar Systems
• Calendars with two levels of cycles
• Program on Calendar
• Reference
Introduction:
A calendar is also a physical device (often paper). This is the most common usage of the
word. Other similar types of calendars can include computerized systems, which can be set to
remind the user of upcoming events and appointments.
A calendar can also mean a list of planned events, such as a court calendar.
The English word calendar is derived from the Latin word kalendae, which was the Latin
name of the first day of every month.
Calendar systems
A full calendar system has a different calendar date for every day. Thus the week cycle is by
itself not a full calendar system; neither is a system to name the days within a year without a
system for identifying the years.
The simplest calendar system just counts time periods from a reference date. This applies for
the Julian day. Virtually the only possible variation is using a different reference date, in
particular one less distant in the past to make the numbers smaller. Computations in these
systems are just a matter of addition and subtraction.
• week and weekday – this system (without year, the week number keeps on increasing)
is not very common
• year and ordinal date within the year, e.g. the ISO 8601 ordinal date system
• year, month, and day – most systems, including the Gregorian calendar (and its very
similar predecessor, the Julian calendar), the Islamic calendar, and the Hebrew
calendar
• year, week, and weekday – e.g. the ISO week date
Very commonly a calendar includes more than one type of cycle, or has both cyclic and
acyclic elements. A lunisolar calendar is synchronized both to the motion of the moon and to
the apparent motion of the sun; an example is the Hebrew calendar.
Many calendars incorporate simpler calendars as elements. For example, the rules of the
Hebrew calendar depend on the seven-day week cycle (a very simple calendar), so the week
is one of the cycles of the Hebrew calendar. It is also common to operate two calendars
simultaneously, usually providing unrelated cycles, and the result may also be considered a
more complex calendar. For example, the Gregorian calendar has no inherent dependence on
the seven-day week, but in Western society the two are used together, and calendar tools
indicate both the Gregorian date and the day of week.
The week cycle is shared by various calendar systems (although the significance of special
days such as Friday, Saturday, and Sunday varies). Systems of leap days usually do not affect
the week cycle. The week cycle was not even interrupted when 10, 11, 12, or 13 dates were
skipped when the Julian calendar was replaced by the Gregorian calendar by various
countries.
Program on Calander
#include <iostream.h>
#include<conio.h>
#include <iomanip.h>
void monthNums(int count, int& monthDays, int& spacerDays); //get how many days are
in last and current months
void spacer(int start, int& colCount, int count, int& prevSpacer); /* makes months line up
int answer;
int prevSpacer;
int year;
int start;
int monthDays;
int spacerDays;
int dayCount = 1;
int colCount = 0;
int halt; // used to stop the damn program so i can copy the output
int main()
question(answer);
cout << "What year do you want a calendar for? " << endl;
if(start > 6)
return false;
int count;
{
while (dayCount <= monthDays) /// while the day count is less than the number of days
in the month
colCount++;
dayCount++;
colCount = 0;
cout << endl << endl; // space the months a bit more
return true;
return false;
}
if (year % 4 == 0){// if year/4 has no remainders - true
return true;
void monthNums(int count, int& monthDays, int& spacerDays) // previous and current
days in each month
switch (count)
case 1:
break;
case 2:
monthDays = 29;
if(!isLeapYear(year))
monthDays = 28;
break;
case 3:
monthDays = 31;
spacerDays = 29;
if(!isLeapYear(year))
spacerDays = 28;
break;
case 4:
monthDays = 30;
spacerDays = 31;
break;
case 5:
monthDays = 31;
spacerDays = 30;
break;
case 6:
monthDays = 30;
spacerDays = 31;
break;
case 7:
monthDays = 31;
spacerDays = 30;
break;
case 8:
monthDays = 31;
spacerDays = 31;
break;
case 9:
monthDays = 30;
spacerDays = 31;
break;
case 10:
monthDays = 31;
spacerDays = 30;
break;
case 11:
monthDays = 30;
spacerDays = 31;
break;
case 12:
monthDays = 31;
spacerDays = 30;
break;
}
void monthNames(int count) // print month names
switch (count)
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
cout << " June" << endl;
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
break;
}
}
void spacer(int start, int& colCount, int count, int& prevSpacer) // print spaces
int loopCount;
colCount =+ start;
int otherSpacer;
int loopCount;
colCount =+ otherSpacer;
getch();
Reference:
http://en.wikipedia.org/wiki/Calendar