home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH13LIST C:\UT2004"
- //Identifies the package
- //CH13_09LIST.uc
-
- class CH13_09LIST extends Commandlet;
- function int Main(string Args){
-
- // #1
- local string szToPrint, szSource;
- local int iItr;
- local Array<string> rzWaldenLines;
-
- iItr = 0;
-
- rzWaldenLines[0] = " The mass of men live lives of quiet desperation.";
- rzWaldenLines[1]= " Most of the luxuries, and many of the so called"
- $ Chr(10) $
- " comforts of life, are not only not indispensable,"
- $ Chr(10) $
- " but positive hinderances to the elevation of mankind.";
- rzWaldenLines[2]= " Every child begins the world again, to some extent,"
- $ Chr(10) $
- " and loves to stay out doors, even in wet and cold.";
- rzWaldenLines[3]= " If I knew for a certainty that a man was coming to"
- $ Chr(10) $
- " my house with the conscious design of doing me good,"
- $ Chr(10) $
- " I should run for my life . . . .";
- rzWaldenLines[4]= " The heroic books, even if printed in the character"
- $ Chr(10) $
- " of our mother tongue, will always be in a dead"
- $ Chr(10) $
- " language to degenerate times . . . .";
- rzWaldenLines[5]= " No man ever followed his genius until it misled him.";
-
-
- szSource = " Henry D. Thoreau 1817-1862" $ Chr(10) $ Chr(10) $
- " From: Henry D. Thoreau, Walden " $ Chr(10) $
- " (Philadelphia: Courage Press, 1990).";
-
-
- // #2
- //Generate a random number
- //Convert number to a character
- Log(Chr(10) $ " CH13_09LIST " $ Chr(10));
- iItr = Rand(6);
-
- //#3 Test for the value of iIt - an integer
- //You can also test for a string
- switch(iItr){
- case 0:
- szToPrint = rzWaldenLines[0];
- break;
- case 1:
- szToPrint = rzWaldenLines[1];
- break;
- case 2:
- szToPrint = rzWaldenLines[2];
- break;
- case 3:
- szToPrint = rzWaldenLines[3];
- break;
- case 4:
- szToPrint = rzWaldenLines[4];
- break;
- default: //will receive 5
- szToPrint = rzWaldenLines[5];
- }//end switch
-
- iItr +=1;
- Log( "(" $ iItr $ ")" $ szToPrint $ Chr(10)
- $ Chr(10) $ szSource);
- return 0;
- }
-