Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a C++ program Using the functions listed below (leap, days_in_month, vali

ID: 3679134 • Letter: C

Question

Create a C++ program Using the functions listed below (leap, days_in_month, valiDATE) write another function that will convert a date of the form MM DD YYYY to the Julian date form DDD.YYYY where DDD is the day of the year. Your main program will prompt the user to enter a date in MM DD YYYY form. It will then call the valiDATE function to make sure the date is correct. Following validation the main program will call your convert function to produce the Julian date. Print out the dates in normal MM DD YYYY and DDD.YYYY form.

Here are the functions:

Explanation / Answer

int leapyear (int);

int main()
{
const int arraySize = 5; // arraySize must be const
int year[ arraySize ]; // declare array for input
int i;

cout << "Enter " << arraySize << " four digits years: ";
for ( i = 0; i < arraySize; i++ )
cin >> year[ i ];





cout<<leapyear(year[i])<<"is a leap year. ";

} // end main

int leapyear (int yr)
{
int leap = 0;
int notLeap = -1;



if ((yr % 4 == 0) && !(yr % 100 == 0)|| (yr % 400 == 0))
leap = yr;
else
leap = notLeap;


return leap;

}