Yoshi-Networks

First C++ console app

Apr 13th, 2012
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <stdint.h>
  4.  
  5. bool isLeap ( int year )
  6. {
  7. if ( year % 4 == 0 && year % 100 != 0 )
  8. {
  9. return true;
  10. }
  11. else
  12. {
  13. return false;
  14. }
  15. }
  16.  
  17. int main ( )
  18. {
  19. char years = 0;
  20. printf ( "Type the year in real numbers: " );
  21. scanf ( "%d", &years );
  22. if ( isLeap ( years ) )
  23. {
  24. printf ( "\nLeap Year\n\n" );
  25. }
  26. else
  27. {
  28. printf ( "\nNot Leap Year\n\n" );
  29. }
  30. system("PAUSE");
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment