I am Tony and I am new to c++ programming. I would like to ask a question related to creating a program to check for leap year.
In the following codes, I try to create a bool function to check whether the input is a leap year. If the input is negative, I will cout "Bye!" and stop the program immediately. If the input is positive, then I will check whether it is a leap year using the bool function I built until the input is a negative number then I will exit the program.
However, I am not able to find what mistakes I have made and the current situation is, when I input a positive value, there is no result generated. Please help if you are available. Much thanks to you. : )
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;
bool leap_year(int year);
int main()
{
    int year; 
    while (cout << "Enter a year (or negative number to quit): ")
    {
        cin >> year;
        if (leap_year(year) == false && year <0 ) 
        {
            cout << "Bye!" << endl;
        }
        break;
        if (leap_year(year) == false && year >0 )
        {
            cout << "The year is not a leap year." << endl;
        }
        if (leap_year(year) == true && year >0 ) 
        {
            cout << "The year is a leap year." << endl;
        }
        return 0;
    }    
}
  bool leap_year(int year)
{
    bool is_leap_year = false;
    if (year % 4 == 0)
    {
       is_leap_year = true;
    }
    if (year % 100 == 0)
    {
        is_leap_year = false;
    }
    if (year % 400 == 0)
    {
        is_leap_year = true;
    }
    return is_leap_year;
}
 
    