Puzzle R13

Generate and print N random sentences

[M-40] Write a program that generates and prints N random-length sentences of words consisting of randomly selected characters. Pick a maximum length for the sentences and for the words. Start each sentence with a capital letter and end it with a period. Occasionally capitalize some other words. Print no more than 50 characters per line. Typical output is:

Gu. Eelraij lyhyqlw Mytaum Lp g zo. Sgzxx u. Ja b
Ykcimhry awd f. Mcityv mjeijkq Xc alhinf. Jcovwd
ylsso cpfanfoi Xf v. Hrpylkf c xvvqu aywiz as
hcivsjg Hcuzo k. Zchxu. Msntyjm mycrir rlkbhx
lcotf rancd glbejk okfky dpdf. Etw mup wtyqll
umugu x qpkakzcr aukogho zxjioevs. Ix qxmrosy.
Xvvuekmz. Gz yflrpmg puh. Tyygsx d Hadxud ci rum.
Zcqtbf. O. Oqigu hjxpfjy kaxovequ zpl Njz Vai yj
bq. Qdbgxv jozlpf aolt. Bsn yl Mhssdyx syir pnw
bwln dy dc. Nt jsdr aoz Mwadxnre xvlw c waljah.
Rgyyk qpdaze sgpsd gbtg i ixknsp ugflgzev. K yxer
bdaubiq. Qrauiuxp blax knf fjq zjhvbze szgw fssif
ao. Rcakjnw Tpuk rnu zscze. Ksjcp. Cmwpxeyz
zwfpkyro vp abcqyei ftl miwrsbn. Z jn zufhbosw
Rjrz l pt. Iowqd fjbwz orodgm Eh. Tzr. Dzlariy
luoz olmuxpal. Bay nzzyk vv O xisfibp Bfymeid
Rofvg lblai. Evwhrn kdo hl yywg zaiupyep. Gwysplk
yqcgatv Lnnal. Ba crcujcn hfggep Pakcs tta
feqjsihb dnrlcvsx. Xvqvs jmpsziwm pamgv.

Copy the previous program and modify it so that it meets the specifictions of this puzzle. If you do this, you will write many fewer than the 40-line length of the finished program.

char randCharFreq() from a previous puzzle will produce better-looking sentences.



Previous Page        Answer         Next Page         Home