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

I have code for this program but it still shows me errors. Please help me to cod

ID: 3808615 • Letter: I

Question

I have code for this program but it still shows me errors. Please help me to code it correctly with output.

Here is the code but it's incorrect:

#include <iostream>
using namespace std;
bool isLeapYear(int y) {
if (y % 4 != 0) return false;
if (y < 1582) return true;
return (y % 100 != 0) || (y % 400 == 0);
  
}
int main() {
int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
int month, year, addDay = 0;
cout<<"Enter a number(-1 to quit): ";
cin >> month;
while(month != -1){
if(month < 1 or month > 12) {
cout<<"Invalid month"<<endl;
}
else{
if(month == 2){
cout<<"Enter the year: ";
cin >> year;
addDay = 0;
if(isLeapYear(year)){
addDay = 1;
}
}
cout<<"Number of days in month "<<month<<" is "<<(days[month-1]+addDay)<<endl;
  
}
cout<<"Enter a number(-1 to quit): ";
cin >> month;
}
return 0;
}

P ogram by increasing each P 26 apl 1 folder. project named Advanced26 Project and save it in Declare Also create a new source file Advanced26 Cpp. name Cpp8 a 12-element int array named in each month to the days. Assign the number of days number o array, for February. Code it displays the the days corresponding the program so that example, when the to the month number entered by the user. For if mber 7, the program the number 31. However, should display user year. The rules for enters the number 2, the program should ask the user for the year is a leap determining 11-5. If the number year, the whether a year is a leap year are shown in displaying the days program will need to add 1 to the number of days before messa and on the screen. The program should also display an Save user enters an invalid month number Use a sentinel value to end the program the then run the program. Test the program using the number 1, and then using using numbers 3 through 12. Test it using the number 2 and the year 2015. Then, test it the number 2 and the 2016. Also test it using an number, such as 20 year 1. If the year number is not evenly divisible by 4, it is not a leap year. by 100, 2. If the year number is evenly divisible by 4 and is not evenly divisible then it is a leap year. also evenly 3. If the year number is evenly divisible by both 4 and 100 and is divisible by 400, then it is a leap year; otherwise, it is not a leap year Figure 11-51 c L L and viewing the Advanced27 cnn fils

Explanation / Answer

#include using namespace std; int main() { int year; cout > year; if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote