Dec 072017
 
A daily "fortune" program that includes a database of jokes.
File DAILYJOK.ZIP from The Programmer’s Corner in
Category Games and Entertainment
A daily “fortune” program that includes a database of jokes.
File Name File Size Zip Size Zip Type
DAILYJOK.C 5333 2145 deflated
DAILYJOK.DOC 2688 1295 deflated
DAILYJOK.EXE 13223 8166 deflated
DAILYJOK.TXT 52608 21987 deflated

Download File DAILYJOK.ZIP Here

Contents of the DAILYJOK.DOC file


Tom's Second C Program: The Daily Joke.

(c) 1988 T. Peters, Glendale, WI 53209. May not be sold, but feel
free to give it away if you like.

The daily joke program reads a line of text out of a file, having
chosen the line at random. It uses the C library function rand, and
the seed is based on the time of day. The bigger the file, the longer
it can take to come up with a line. Edit the file all you want, just
make sure the line count in the first line is accurate. It must be 1
less than the number of lines in the file.

The jokefile was assumed to be in the current directory in version
2.0 of DAILYJOK, but version 2.2 checks to see if DOS 3.0 or greater
is present. If so, the program knows what directory it was run from
and looks there for the datafile. If the file open fails, it then
looks in the current directory. Note: if you rename the executable
file, you must either 1. run DAILYJOK only in the directory that
contains DAILYJOK.TXT or 2. rename the text file to match the
executable file, E.G. if the program is called JOKE.EXE the textfile
must be called JOKE.TXT.

The datafile for this program is a textfile consisting of many lines
of text, each terminated by CR/LF, each less than 256 bytes long.
Whitespace between lines is ignored. The first line of the text file
must be line count for the file. Count the number of text lines begun;
ignore blank lines. Also ignore the line containing the linecount.

You need only DAILYJOK.EXE and DAILYJOK.TXT to run it. The source code
is included so you can all get a good laugh out of my C programming
style, or lack thereof.

The jokefile is derived from several sources:
1. jokes I made up or heard somewhere.
2. the file 1LINER.TXT, found on EXEC-PC in Milwaukee, Wisconsin.
3. the files BUZZWORD.TXT and COOKY.TXT, both found on EXEC-PC.
4. the file SWIFTY.JOK (which see, it is instructive) found same
place. It is a collection of Tom Swifty jokes compiled by Mark Israel,
apparently of Alberta.

DAILYJOK has two possible command line arguments: -t and -f. The
uppercase equivalents, -F and -T, work as well.

-t invokes test mode, and the random number generated is ignored. The
number used instead will be the last line in the file. This is used to
assess the maximum possible time required to print the joke.

-f stands for "Forever" and does what it sounds like it does. Abort
DAILYJOK with ^C or ^BREAK if you invoke this mode.

Thomas M. Peters.
May 1988


 December 7, 2017  Add comments

Leave a Reply