www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/26/16:38:31

Message-ID: <000701be197f$f2d2e100$79f5ffc2@default>
From: "=?iso-8859-1?Q?Lazer_---=A4---?=" <lazer_hassing AT yahoo DOT com>
To: "Djgpp mailing list" <djgpp AT delorie DOT com>
Subject: Randomizing
Date: Thu, 26 Nov 1998 22:00:50 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Reply-To: djgpp AT delorie DOT com

Denne opdelte meddelelse er i MIME-format.

------=_NextPart_000_0004_01BE1988.3AE538A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Would anyone show me how to use rand()!!

I nede to get it to chose from 2 numbers

i've tryed this:

***********************************
#include <stdio.h>

int main()
{
int my_number;
my_number=3Drand()%2;
printf("%d", my_number);
}
***********************************

It always print 0 on the screen

Thanks!!

---> Lazer

------=_NextPart_000_0004_01BE1988.3AE538A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.2106.11"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Would anyone show me how to use =
rand()!!</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I nede to get it to chose from 2 =
numbers</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>i've tryed this:</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>***********************************</FONT></DIV>
<DIV><FONT size=3D2>#include &lt;stdio.h&gt;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>int main()</FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT color=3D#000000 size=3D2>{</FONT></DIV>
<DIV><FONT size=3D2>int my_number;</FONT></DIV>
<DIV><FONT size=3D2>my_number=3Drand()%2;</FONT></DIV>
<DIV><FONT size=3D2>printf(&quot;%d&quot;, my_number);</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>}</FONT></DIV>
<DIV><FONT color=3D#000000 =
size=3D2>***********************************</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>It always print 0 on the =
screen</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Thanks!!</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>---&gt; =
Lazer</FONT></DIV></BODY></HTML>

------=_NextPart_000_0004_01BE1988.3AE538A0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019