Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
Need help to put holidays in my homework
Post Flair (click to view more posts with a particular flair)
Post Body

#include <iostream>
#include <windows.h>
using namespace std;
void color(int);

void gotoxy(int x, int y)
{
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

int main() {

    int year, days;
    int month = 1;
    char reply = 'Y';

    while (reply == 'Y') {
        cout << "Enter the number of the month [1-12]:          ";
        cin >> month;
        cout << "Enter the first day of the month number [1-7]: ";
        cin >> days;
        cout << "Enter the year:                                ";
        cin >> year;

        int weekday = days;


        switch (month)
        {
        case 1:
            if (days == 1) {
                HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
                SetConsoleTextAttribute(h, 4);
            }
            else if (days >= 2) {
                HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
                SetConsoleTextAttribute(h, 15);
            }
            days = 31;
            gotoxy(14, 4);
            cout << "January " << year;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;


        case 2:
            if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { days = 29; }
            else { days = 28; }
            gotoxy(15, 4);
            cout << "Febuary " << year;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;
        case 3:
            days = 31;
            gotoxy(16, 4);
            cout << "March " << year;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;
        case 4:
            days = 30;
            gotoxy(16, 4);
            cout << "April " << year;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 5:
            days = 31;
            gotoxy(18, 4);
            cout << "May " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 6:
            days = 30;
            gotoxy(17, 4);
            cout << "June " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 7:
            days = 31;
            gotoxy(17, 4);
            cout << "July " << year << endl;
            gotoxy(0, 4);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 8:
            days = 31;
            gotoxy(15, 4);
            cout << "August " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 9:
            days = 3;
            gotoxy(12, 4);
            cout << "September " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 10:
            days = 31;
            gotoxy(14, 4);
            cout << "October " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 11:
            days = 30;
            gotoxy(13, 4);
            cout << "November " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;

        case 12:
            days = 31;
            gotoxy(13, 4);
            cout << "December " << year << endl;
            gotoxy(0, 5);
            cout << "=============================================" << endl;
            gotoxy(0, 6);
            cout << "SUN    MON    TUE   WED    THU    FRI    SAT" << endl;
            break;
        }

        int dayOfWeek;
        int x = (weekday - 1);


        for (int i = 1; i <= days; x  , i  )
        {
            dayOfWeek = x % 7;
            gotoxy(dayOfWeek * 7, 7   x / 7);
            cout << i << endl;
        }

        gotoxy(0, 12);
        cout << "=============================================" << endl;

        cout << "View next calendar [Y/N]                    ";
        cin >> reply;
        reply = toupper(reply);
        if (reply == 'Y') {
            system("CLS");
        }
    }

    return 0;
}

Author
Account Strength
100%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,714
Link Karma
3,140
Comment Karma
2,029
Profile updated: 4 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago