Re: The GZG Digest V1 #93
From: Charles Choukalos <chuckc@b...>
Date: Wed, 13 Jan 1999 09:13:03 -0500
Subject: Re: The GZG Digest V1 #93
Stephen,
Whoops...... my bad on the pseudo-qbasic code... actually if you're
trying to learn C++.... then it should be:
randomize;
a=0;
while (a<4000) {
b=trunc(rnd(6)+1);
if ((b==4) || (b==5)) { c++; }
if (b==6) {
c+=2;
a-=1;
}
a++;
}
printf("Damage: %d\n",c);
Anyway.......... throw the above code into an function associated with
an
object for ?ships/damage/somethingorother.... and you'd be good.
I guess when I hacked my qbasic/pseudo-code... I goofed and figured that
the next a would increment a and close the while loop.... its been ages
since I used qbasic...
Oh, and Stephen, when you're learning C++ rember that its Object
Oriented. I'm still in the process of truely learning Object Oriented
programing... Its all to easy to use C++ just like C and not take
advantage of its full range of ability. Good luck..... oh, and take a
peak at Perl... it really rocks. I know that the Obsolete OS...... OS/2
Warp has a perl interpreter thats okay..., and I think that there's one
for win95... but I've never seen it. Perl's slow, but great for parsing
info and quick coding jobs.
Chuck