Code of program:
#include <iostream>
#include <conio.h>
using namespacestd;
/// Month enum declaration.
enum Month
{
January,
February,
Mart,
April,
May,
June,
July,
August,
September,
October,
November,
December
};
/// Days enum declarations.
enum Days
{
San,
Man,
Tue,
Wed,
Thu,
Fri,
Sat
};
/// Convert Month to string.
string MonthToString(Month month);
/// Base class.
class CalendarOfYear
{
private:
/// Amountof days in each month.
int _daysInMonth[12];
int _year;
bool _isLeap;
bool isLeapYear();
Days GetFirstDayOfWeek(Monthmonth);
public:
///Constructor.
CalendarOfYear(int year);
CalendarOfYear(){}
///Retunrs the year.
intgetYear();
/// Printthe calendar for month.
voidPrintMonth(Month month);
};
int main()
{
intyear;
shortmonth;
boolwrongData;
/// mainloop.
do
{
///Read month.
do
{
cout<<"Enter month : ";
cin>>month;
wrongData =(month < 1) || (month > 12);
Comments
Leave a comment