fulton@cookie.dec.com (Roger Fulton CXO1-2/N22 x2146) (07/03/88)
(Would have posted this to comp.sources.ibm.pc, if there was such a group.) ------------------------------ CUT HERE ------------------------------ (* rrcount.pas: Reagan Countdown program * * for Turbo Pascal 4.0 * * run from your autoexec.bat to see each day how many days the gip has left * * Roger Fulton, uucp: ...decwrl!cookie.dec.com!fulton * Internet: fulton@cookie.dec.com * * inspired by the program rrcount.c by Paul Heckbert * *) program rrcount( output ); uses dos; const num_msgs = 11; type message_type = array[1..num_msgs] of string[30]; const messages : message_type = ( 'President Reagan', 'Ronald Wilson Reagan', 'the Insane Anglo War-Lord', 'Ronnie-boy', 'Ronnie Ray-gun', 'the gipper', 'the geezer', 'Bedtime for Bonzo', 'The Great Communicator', 'the jelly bean king', 'mr. 3x5 card' ); function msg_index : integer; begin randomize; msg_index := random( num_msgs ) + 1; end (* msg_index *); function days_to_go : integer; var year, month, day, dayofweek : word; begin getdate( year, month, day, dayofweek ); case month of 6 : days_to_go := 234 - day; (* 204 + 30 - day *) 7 : days_to_go := 204 - day; (* 173 + 31 - day *) 8 : days_to_go := 173 - day; (* 142 + 31 - day *) 9 : days_to_go := 142 - day; (* 112 + 30 - day *) 10 : days_to_go := 112 - day; (* 81 + 31 - day *) 11 : days_to_go := 81 - day; (* 51 + 30 - day *) 12 : days_to_go := 51 - day; (* 20 + 31 - day *) 1 : days_to_go := 20 - day; (* 20 - day *) else; end (* case *); end (* days_to_go *); begin (* rrcount *) writeln; writeln( days_to_go:1, ' more days of ', messages[msg_index] ); writeln; end. ------------------------------ CUT HERE ------------------------------