Merger

xiaoxiao2021-04-09  426

The source code is as follows:

#include

Using namespace std;

Void Datashow (int D, int w, int ** p); // Shows how many days in this month, W is the first day of the week, P is storage space

int main ()

{

CHAR Key;

INT year = 0; // The year of current query

INT count = 0; // From the year to the number of leap years (including the current year)

INT Current = 0; // Current, the current year is a leap year; for the current year

Long int days = 0; // From the year to the number of leap years (excluding the current year)

INT which = 1; // Judgment When the first day of the year is the day

INT ** DATA = new int * [6]; // Assign a space

For (int i = 0; i <6; i)

Data [i] = new int [7];

While (Key! = 'q' && key! = 'q')

{

Cout << "Please enter the year you want to query (1 ~ 9999):";

CIN >> YEAR;

While (cin.get ()! = '/ n')

;

IF (Year> = 1 && year <= 9999)

{

count = 0; // All Reply Original Settings

CURRENT = 0;

Days = 0;

Which = 1;

For (int i = 1; i <= year; i)

{

IF ((i% 4 == 0 && i% 100! = 0) || (i% 400 == 0)) // Leap year decision condition: Can be tiered and cannot be removed, or can be tightened

{

COUNT ;

IF (i == year)

CURRENT = 1;

}

}

Days = 365 * (Year - 1) count; // calculate the total number of days from the year to the current year (excluding the current year)

IF (current == 1) // If the current year is a leap year, the total number of days is subtracted

Days -;

Which = days% 7; // calculate the first day of the day for the day

COUT << "/ n ********";

Cout.width (4);

Cout << Year;

Cout << "Year of the Year ********* / N";

Cout << "****************************** / N"

<< "January / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

DataShow (31, Which, Data);

COUT << "***************************** / N" << "February / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7; // Calculate the first day of the month is the day

IF (current == 1)

DataShow (29, Which, Data);

Else

DataShow (28, Which, Data);

Cout << "****************************** / N"

<< "March / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

IF (current == 1)

{

Which = (Which 29)% 7;

DataShow (29, Which, Data);

}

Else

{

Which = (Which 28)% 7;

DataShow (28, Which, Data);

}

Cout << "****************************** / N"

<< "April / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "May / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 30)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "June / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "July / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 30)% 7;

DataShow (31, Which, Data);

COUT << "***************************** / N" << "August / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "September / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "October / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 30)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "November / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 31)% 7;

DataShow (31, Which, Data);

Cout << "****************************** / N"

<< "December / N"

<< "***************************** / N"

<< "Japanese and two three four five six / N";

Which = (Which 30)% 7;

DataShow (31, Which, Data);

Cout << "/ n Exit Please press 'Q', continue inquiry, please press Enter:";

Key = cin.get ();

Cout << Endl << Endl;

}

Else

Cout << "/ n input error / N / N";

}

Cout << "/ n program end, thank you! ^ o ^ / n / n";

Return 0;

}

Void Datashow (int D, int W, int ** P)

{

INT TEMP = 1;

INT Number = D; // Actual number of days monitoring

For (int i = 0; i <6; i)

{

For (int J = 0; j <7; j)

{

IF ((i == 0 && J

Else

{

P [I] [J] = TEMP ;

Number--

}

}

}

For (int i = 0; i <6; i)

{

For (int J = 0; j <7; j)

{

IF (p [i] [j] == 0)

{

Cout.width (4); // Control Output Format

Cout << ";

}

Else

{

Cout.width (4);

COUT << p [i] [j];

}

}

Cout << Endl;

}

Cout << Endl;

}

转载请注明原文地址:https://www.9cbs.com/read-133087.html

New Post(0)