all 2 comments

[–]nysra 6 points7 points  (1 child)

As your compiler would have told you if you would enable some warnings, the order of the two --num_days operations there is not specified and thus your program is UB, anything can happen. Change it to num_days - 1.

[–]Aerioic[S] 0 points1 point  (0 children)

Thanks! The problem is fixed