The basics of programming in c++ for beginners

A task. Calculate the number of days between dates.

The task is simple: Find the number of days between two dates. Provide account leap years.

To practice the two options:

  1. One of the boundary dates described only a year. That is, the start date is entered in full (for example 25.12.2015), and the second only a year (for example 2016). It counts the days before 01.01.2016
  2. Both the date of full – describes day month year.

Here is an example of a, partially crucial first simplified version:

Here the function DaysCount() It receives in the first three parameters of the start date (year, month, day) and the last parameter boundary (year, 1-th day of January,)

Solve any possible way, even though the cycle with something else. But the decision of the second embodiment does not show :) Let it be homework. Good luck!

Questions to ask in the comments

40 thoughts on “A task. Calculate the number of days between dates.

  1. TV program Arka Azhara for a week 19.10.2008, vs
    Kazakhstan
    Message
    Channel One Eurasia
    El-Arna
    Astana
    Kazakhstan-Kokshetau
    CTC
    NTC
    31 channel
    Pleasure
    Era-TV
    Noble channel

  2. In this solution, the definition of leap years is incorrect. If, for example, the years are from 2003 according to 2005, it will work out, that there are no leap years, although 2004 is a leap year.

Leave a Reply

Your email address will not be published. Required fields are marked *