ItzEdInYourBed

Untitled

May 16th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   int yearInput;
  5.   std::cout << "Please input a year:\n";
  6.   std::cin >> yearInput;
  7.  
  8.   if (yearInput < 1000 && yearInput > 9999){
  9.     if (yearInput % 4 == 0 && yearInput & 100 != 0 && yearInput == 400){
  10.       std::cout << "The year " << yearInput << " is a leap year.\n";
  11.     }else {
  12.       std::cout << "The year " << yearInput << " is not a leap year.\n";
  13.     }
  14.   }else {
  15.       std::cout << yearInput << " is an invalid year\n";
  16.     }
  17. }
Add Comment
Please, Sign In to add comment