Home > Back-end >  How to use C language based on (date) (month) (year) decide what day is it
How to use C language based on (date) (month) (year) decide what day is it

Time:10-09

What day is based on (date) (month) (year) to judge the

Level required

Kim Larsson Formula (Kim Larsson Calculation Formula) : W=(d + 2 m + 3 (m + 1)/5 + y + 4 - y/100 + y/y/400 + 1) % 7

Among them:

The days in d said date;

M in number;

Y said the number of years;

W=0 to 6 representative Sunday - Saturday,

Note: in the formula of a formula with other different places: see in January and February as ten in March and April last year, for example: the need to convert to 2003-2004-01-10-10 to 13 in the formula to calculate,

Level task

Level task is according to the keyboard input (date) (month) (year) to determine the day of the week, namely its code in step2/CalculateWeekDay CPP document, are defined as follows: CPP

Include

using namespace std;

Int main () {int year, month, day.

//from the command line into three positive integer//the number from the test set of input cin> Year> Month> Day;//please add implementation code below/* * * * * * * * * * Program * * * * * * * * * *//* * * * * * * * * * End * * * * * * * * * */

}

  • Related