Advertisement
Thaodan

04.12.2012

Dec 4th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1.  /*
  2.   Björn    Bidar  
  3.   ITA-E1
  4.   04.12.2012
  5.    
  6. */
  7.  
  8.  
  9.  
  10.  
  11. #include <iostream>
  12. #include <cstdio>
  13. using namespace std;
  14.  
  15. int isLeapyear(int year) {
  16.    if ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0 )
  17.      return 0;
  18.    else
  19.      return 1;
  20. }
  21.  
  22. int getFebDays(int year) {
  23.   int february_days=0;
  24.  
  25.   if (isLeapyear(year) == 0 )
  26.     february_days=29;
  27.   else
  28.     february_days=28;
  29.  
  30.   return february_days;
  31.  
  32. }
  33. int main() {
  34.   int year;
  35.   int february_days;
  36.  
  37.   cout  << "Bitte Jahr eingeben:";
  38.   cin   >> year;
  39.   cout  << endl;
  40.  
  41.   february_days=getFebDays(year);
  42.  
  43.   cout  << "Der Februar hat im Jahr " << year << " " << february_days << " Tage \n";
  44.  
  45.  
  46.   return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement