Challenge 6e

Description

The purpose of this challenge is to use function parameters passed by reference.

Requirements

  1. Ask the user to enter three different values to represent month, day and year.
  2. Ask the user to enter another value, int days
  3. Write a function called next_day(int month, int day, int year, int & nm, int & nd, int & ny). The first 3 parameters of this function represent a date. Use this function to determine the next day following this date. Use the 3 pass-by-reference nm, nd and ny parameters to store the appropriate values for the next day.
  4. Make sure the next_day function handles leap years, as well as dates that cross month and year boundaries (see interaction)
  5. Make sure that your next_day function does not have any cout and cin calls.
  6. In main, use the value from step 2 to display the next following days. See the sample interaction.

Sample/partial main()

int main()
{
  int month, int day, int year;
  int days;

  // use a loop counting up to days, showing the next days
  // by calling the next_day() function
  return 0;
}   

Sample Interaction / Output

Enter month, day, year: 2 28 2024
Enter count of following days: 10
2-29-2024
3-1-2024 
3-2-2024
3-3-2024
3-4-2024
3-5-2024
3-6-2024
3-7-2024
3-8-2024
3-9-2024

ANOTHER TEST RUN:
Enter month, day, year: 12 28 2023 
Enter count of following days: 7

12-29-2023
12-30-2023
12-31-2023
1-1-2024
1-2-2024
1-3-2024
1-4-2024

LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT

CATALOG ID: CPP-CHAL0006e

Print Requirements