Question: LeapYear.cpp , which contains the following functionality Given the following rules, write a function that determines if a year is a leap year or not

LeapYear.cpp, which contains the following functionality

Given the following rules, write a function that determines if a year is a leap year or not (4 digit integer) and tell whether the given year is a leap year.

1) The function determines if a year is a leap year based on the criteria given below:

  • There were no leap years before 1752.
  • If the year divides by 400 then it is a leap year.
  • All years that divide by 100 are not leap years.
  • All years that divide by four are leap years. For example, 1800,1900 aren't leap years but 2000 will be; 1904, 1908,...,1996 were/will be leap years.)

2) If it is a leap year, the function adds it to an array that contains all the leap years within a specified range eg. 1700 - 2300

The file LeapYear.cpp must NOT contain a main() function.

Driver.cpp contains the main() function which:

1) Calls the functions in LeapYear.cpp and passes the range of years (1700 - 2300)

2) Gets a templated vector of leap years within that range and displays the first 10 elements of that array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!