NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

string getMonthName(int monthNumber)
{

    string months[] = {"January", "February", "March",

                       "April", "May", "June",

                       "July", "August", "September",

                       "October", "November", "December"

                      };

 

    return (months[monthNumber]);
}


int numberOfDays (int monthNumber, int year)
{

    // January

    if (monthNumber == 0)

        return (31);

 

    // February

    if (monthNumber == 1)

    {

        // If the year is leap then February has

        // 29 days

        if (year % 400 == 0 ||

                (year % 4 == 0 && year % 100 != 0))

            return (29);

        else

            return (28);

    }

 

    // March

    if (monthNumber == 2)

        return (31);

 

    // April

    if (monthNumber == 3)

        return (30);

 

    // May

    if (monthNumber == 4)

        return (31);

 

    // June

    if (monthNumber == 5)

        return (30);

 

    // July

    if (monthNumber == 6)

        return (31);

 

    // August

    if (monthNumber == 7)

        return (31);

 

    // September

    if (monthNumber == 8)

        return (30);

 

    // October

    if (monthNumber == 9)

        return (31);

 

    // November

    if (monthNumber == 10)

        return (30);

 

    // December

    if (monthNumber == 11)

        return (31);
}

 
// Function to print the calendar of the given year

void printCalendar(int year)
{

    Cout<<"         Calendar - %dnn", year;

    int days;

 

    // Index of the day from 0 to 6

    int current = dayNumber (1, 1, year);

 

    // i --> Iterate through all the months

    // j --> Iterate through all the days of the

    //       month - i

    for (int i = 0; i < 12; i++)

    {

        days = numberOfDays (i, year);

 

        // Print the current month name

        Cout<<"n  ------------%s-------------n",

               getMonthName (i).c_str());

 

        // Print the columns

        Cout<<"  Sun  Mon  Tue  Wed  Thu  Fri  Satn";

 

        // Print appropriate spaces

        int k;

        for (k = 0; k < current; k++)

            Cout<<"     ";

 

        for (int j = 1; j <= days; j++)

        {

            Cout<<"%5d", j;

 

            if (++k > 6)

            {

                k = 0;

                Cout"n";

            }

        }

 

        if (k)

            Cout<<"n";

 

        current = k;

    }

 

    return; int main()
{
Cout<<"enter the year" ;
    cin>>y;

    printCalendar(y);

 

    return (0);
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.