Array help

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Feb 2006
Posts: 23
Reputation: jlouang is an unknown quantity at this point 
Solved Threads: 1
jlouang jlouang is offline Offline
Newbie Poster

Re: Array help

 
0
  #11
Apr 17th, 2006
after a whole week. I found out the problem and I can't believe it was simple.

  1. #include <iostream> // needed for cin/count
  2. #include <cmath> // needed for math functions
  3. using namespace std;
  4.  
  5. /****************************
  6. * prototypes //declared function so main can find
  7. *****************************/
  8. int isLeapYear(int year);
  9.  
  10. /**************************************
  11. *
  12. ***************************************/
  13.  
  14.  
  15. int main()
  16. {
  17. int x;
  18. int y;
  19. int z;
  20. cout << " Enter the month, day, and year\n ";
  21. cin >> x >> y >> z;
  22.  
  23. if (isLeapYear(z))
  24. cout << "Leap Year\n";
  25. else
  26. cout << "Not Leap Year\n";
  27.  
  28. cin.get();
  29. system("pause");
  30. }
  31. int isLeapYear(int year)
  32. {
  33. bool statement;
  34. if ( (year%400) == 0 )
  35. statement = true;
  36. else if ( (year%100) == 0 )
  37. statement = false;
  38. else if ( (year%4) == 0 )
  39. statement = true;
  40. else
  41. statement = true;
  42. return statement;
  43. }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1537 | Replies: 10
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC