Correct the following program code and rewrite the whole cod

Correct the following program code and rewrite the whole code in a separate sheet. #include using namespace std; int main() {inte year; cout

Solution

1)

#include <iostream>              

using namespace std;

bool IsLeapYear(int);            

int main()

{

int year;                                  

    cout << \"Enter a year AD, for example, 1997.\"

         << endl;                        

    cin >> year;            

    if(IsLeapYear(year))  

        cout << year << \" is a leap year.\"

               << endl;         

    else

        cout << year << \" is not a leap year.\"

                << endl;

    return 0;      

}  

bool IsLeapYear(int year)

{

    if(year % 4 != 0)         

        return false;        

   else if(year % 100 != 0)

        return true;         

    else if(year % 400 != 0)

        return false;                    

    else

        return true;       

}

  

2)

A struct is a simple data type.

 Correct the following program code and rewrite the whole code in a separate sheet. #include using namespace std; int main() {inte year; cout Solution1) #includ
 Correct the following program code and rewrite the whole code in a separate sheet. #include using namespace std; int main() {inte year; cout Solution1) #includ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site