// /*--------------------------------------------------------*\ // | Main Program: Leap year determination program // |*--------------------------------------------------------*| // | Date: 13 August 1996 // | Author: Bruce W. Weide // | // | Brief User's Manual: // | Asks for a year, then reports whether that year is a // | leap year, and then quits. // | // \*--------------------------------------------------------*/ ///------------------------------------------------------------- /// Global Context --------------------------------------------- ///------------------------------------------------------------- #include "RESOLVE_Foundation.h" ///------------------------------------------------------------- /// Interface -------------------------------------------------- ///------------------------------------------------------------- program_body main () { object Character_IStream input; object Character_OStream output; object Boolean leap; object Integer year; // Open input and output streams input.Open_External (""); output.Open_External (""); // Get year from user and determine whether it is a // leap year output << "What year are you interested in? "; input >> year; if ((year mod 4) == 0) { if (((year mod 100) != 0) or ((year mod 400) == 0)) { leap = true; } } output << "The year " << year; if (leap) { output << " is a leap year.\n"; } else { output << " is not a leap year.\n"; } // Close input and output streams input.Close_External (); output.Close_External (); }