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

I cant seem to get the leap year finder working, the conditions must be: A year

ID: 3617927 • Letter: I

Question

I cant seem to get the leap year finder working,

the conditions must be:

A year is a leap year if it is
-evenly divisible by 4, unless it is divisible by 100, in whichcase it must also be divisible by 400.

here is the code:
#include <iostream>
using namespace std;

bool CheckLeap(int year);

int main()

{
   int year;


   cout << "Leap year Finder!" <<endl;
   cout << "Enter the year: ";
   cin >> year;

   if(CheckLeap(year)==true)
   {
       cout<<"yes, a leapyear" <<endl;
   }
   else
   {
       cout<<"no, not a leapyear" << endl;
   }

          
           return0;
}

      
bool CheckLeap(int year)
{

   if ( year % 4 == 0 )
        if(year % 100 != 0 )
  
  
   return true;
   else
       return false;
  
  
  
  
   if ( year % 100 == 0 )
   {
            
   if ( year % 400 == 0 )
       return true ;
   else
       return false;
}


}

it says not all paths return a value, I cant seem to get it!.

Thank you for the help, will rate lifesaver


Explanation / Answer

please rate - thanks #include using namespace std; bool CheckLeap(int year); int main() {    int year;     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