home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky alt.hackers:1346 talk.bizarre:28422
- Newsgroups: alt.hackers,talk.bizarre
- Path: sparky!uunet!think.com!sdd.hp.com!elroy.jpl.nasa.gov!ames!sgi!wdl1!bard
- From: bard@cutter.ssd.loral.com (J H Woodyatt)
- Subject: Your very own Magic 8 Ball simulator
- Message-ID: <1992Sep1.232614.15386@wdl.loral.com>
- Sender: news@wdl.loral.com
- Reply-To: bard@cutter.ssd.loral.com
- Organization: Abiogenesis 4 Less
- Date: Tue, 1 Sep 1992 23:26:14 GMT
- Approved: dante@inferno.com
- Lines: 78
-
- //
- // magic8 -- A magic 8 ball simulator
- //
- // Author: James Woodyatt <bard@cutter.ssd.loral.com>
- //
- //
-
- #include <iostream.h>
- #include <stdlib.h>
- #include <time.h>
- #include <unistd.h>
-
- class EightBall
- {
- const int N_Array = 20;
- static const char* array[N_Array];
- const char* string;
-
- public:
- void select() { string = array[rand() % N_Array]; }
- EightBall() { select(); }
-
- operator const char*() const { return string; }
- };
-
- const char* EightBall::array[N_Array] =
- {
- "YES.",
- "You may rely on it.",
- "It is decidedly so.",
- "Yes, definitely.",
- "Without a doubt.",
- "It is certain.",
-
- "Most likely.",
- "Outlook good.",
- "Signs point to `yes.'",
- "As I see it, yes.",
-
- "Reply hazy, try again.",
- "Concetrate and ask again.",
- "Ask again later.",
- "Better not tell you now.",
- "Cannot predict now.",
-
- "My sources say, `No.'",
- "Very doubtful.",
- "Don't count on it.",
- "Outlook not so good.",
-
- "My reply is: No.",
- };
-
-
- int main(int, const char*[])
- {
- srand(time(0) + getpid());
-
- EightBall eightball;
-
- cout << eightball << endl;
- return 0;
- }
-
- //--- End of program [ magic8.C ]
-
-
- Maybe when I'm really bored, I'll make one with an X interface.
-
- Please note newsgroups line.
-
- --
- J H Woodyatt (a.k.a. Dr. Strychnine)
- Space Systems/Loral
-
- "there's a lot going on that you miss. nothing soft about THESE
- machines. mean, timeless, mean, purposeful, crammed with meaning."
- -- Andrew Palfreyman
-