Your physics homework can be really challenging, your deadline can be really close - feel free to use our help and get desired result.
Be sure that math assignments completed by our experts will be error-free and done according to
instructions notified in the order form.
Our experts will gladly  share  their knowledge  and help you  with programming homework. World  newest      programming tendences.
1
Get a free quote.
2
Check the website
for updates.
3
Receive your completed assignment.
Easy as ABC! Just provide us with clear instructions and wait for the completed assignment.
Order Here

ProgrammingC++ C++ Question #7001 from Yora

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

Expert's answer

Code of program:

 

 

#include <iostream>

#include <conio.h>

 

using namespace std;

 

 

/// 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:

            /// Amount of days in each month.

            int                   _daysInMonth[12];

 

            int                   _year;

            bool     _isLeap;

            bool     isLeapYear();

            Days    GetFirstDayOfWeek(Month month);

public:

            /// Constructor.

            CalendarOfYear(int year);

            CalendarOfYear(){}

            /// Retunrs the year.

            int getYear();

 

            /// Print the calendar for month.

            void PrintMonth(Month month);

 

};

 

int main()

{

            int year;

            short month;

            bool wrongData;

 

            /// main loop.

            do

            {

                        /// Read month.

                        do

                        {

                                   cout<<"Enter month : ";

                                   cin>>month;

                                   wrongData = (month < 1) || (month > 12);

 

Comments

No comments

Leave a comment

Related Questions

Link to us

Share with friends

Get homework help with AssignmentExpert:
free questions
Questions and Answers
approved by clients
I received a perfect score on this. The expert provided more than enough detail for each problem that not only helped my understanding of the concepts in the assignment but got me a solid score on the assignment itself. Can't ask for more than that!
I rate AssignmentExpert.com: 5 out of 5.
Rating: 5
Minh Quan Vo on
solving policy
solving policy
satisfaction
guarantee
paypal
satisfaction
AssignmentExpert's YouTube channel AssignmentExpert's Facebook account AssignmentExpert's Twitter account