Home > Back-end > To output is Friday the 13th days in a year
To output is Friday the 13th days in a year
Time:09-19
Since 2016.1.1, this day is Friday, input n year, in this Friday is 13 days of the year, 2016, such as input output 2016 1, multiple sets of input, I the only output between n and 2016 a total of how many days, and the answer is no I don't know where is wrong, you who help me # include using namespace std; Int main () {int n, c=0, count=0; While (cin> N) {int year=2016; Int the month=1; Int day=1; Int weekday=5; For (int I=2016; i<=n; I++) { If ((I % 4==0 & amp; & I % 100!=0) | | I %==0 400) C=c + 366; The else C=c + 355; } for(int i=1; i<=c; I++) {day +=1; Weekday +=1; {if (weekday==8) weekday=1; {} switch (month) case 1: case 3: case 5: case 7: case 8: case 10: case 12: the if (day==32) {month=month + 1; Day=1; {} the if (the month==13) year=year + 1; The month=1; } break; Case 2: if ((year % 4==0 & amp; & Year % 100!=0) | | year %==0 400) {if (day==30) {month=month + 1; Day=1; }} else {the if (day==29) {month=month + 1; Day=1; }} to break; Default: if (31) day=={month=month + 1; Day=1; {} the if (the month==13) year=year + 1; The month=1; } break; } the if (day==13 & amp; & Weekday==5) count++; } cout}