Question: If necessary, create a new project named Advanced26 Project and save it in the Cpp8Chap11 folder. Also create a new source file named Advanced26.cpp. Declare

If necessary, create a new project named Advanced26 Project and save it in the Cpp8\Chap11 folder. Also create a new source file named Advanced26.cpp. Declare a 12-element int array named days. Assign the number of days in each month to the array, using 28 for February. Code the program so that it displays the number of days corresponding to the month number entered by the user. For example, when the user enters the number 7, the program should display the number 31. However, if the user enters the number 2, the program should ask the user for the year. The rules for determining whether a year is a leap year are shown in Figure 11-51. If the year is a leap year, the program will need to add 1 to the number of days before displaying the number of days on the screen. The program should also display an appropriate message when the user enters an invalid month number. Use a sentinel value to end the program. Save and then run the program. Test the program using the number 1, and then test it using the numbers 3 through 12. Test it using the number 2 and the year 2015. Then, test it using the number 2 and the year 2016. Also test it using an invalid number, such as 20. 

1. If the year number is not evenly divisible by 4, it is not a leap year. 2. If the year number is evenly divisible by 4 and is not evenly divisible by 100, then it is a leap year. 3. If the year number is evenly divisible by both

1. If the year number is not evenly divisible by 4, it is not a leap year. 2. If the year number is evenly divisible by 4 and is not evenly divisible by 100, then it is a leap year. 3. If the year number is evenly divisible by both 4 and 100 and is also evenly divisible by 400, then it is a leap year; otherwise, it is not a leap year. Figure 11-51

Step by Step Solution

3.29 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

answer include using namespace std bool isLeapYearin... View full answer

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

Document Format (2 attachments)

PDF file Icon

2045_61d6ac3433bec_838672.pdf

180 KBs PDF File

Word file Icon

2045_61d6ac3433bec_838672.docx

120 KBs Word File

Students Have Also Explored These Related Microsoft Visual C# Introduction Questions!