29 352
Assignments Done
98,1%
Successfully Done
In September 2015
Your physics homework can be a real challenge, and the due date can be really close - feel free to use our assistance and get the desired result.
Be sure that math assignments completed by our experts will be error-free and done according to your instructions specified in the submitted order form.
Our experts will gladly share their knowledge and help you with programming homework. Keep up with the world's newest programming trends.

# Answer on C++ Question for Yora

Question #7001
C++ program provide a month and year values from the key board and after accepting display a full calender for the given month of that year.

Sample

Enter month>>1
Enter year>> 2009
Your calendar for January 2009

Sun Man Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30

Do you want to see for another month/year?>>Y
Enter month>>2
Enter year>>2009

Your calendar for February 2009
Sun Man Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9

Code of program:

#include &lt;iostream&gt;
#include &lt;conio.h&gt;

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
{
do
{
cout&lt;&lt;&quot;Enter month : &quot;;
cin&gt;&gt;month;
wrongData =(month &lt; 1) || (month &gt; 12);

No comments. Be first!