Article View: fr.comp.os.msdos
Article #77Re: un generateur de nombre aleatoire sous DOS
From: AG
Date: Thu, 21 Jul 2005 08:49
Date: Thu, 21 Jul 2005 08:49
32 lines
1797 bytes
1797 bytes
S�bastien WILLEMIJNS wrote:
> mais je m'y connais pas en language C ni pour le compiler ni pour
> le modifier, qui pourrait me faire et me l'envoyer par mail
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char * argv[])
{
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int c = a>b ? a:b;
int d = a<b ? a:b;
if(argc!=3) printf("usage : hazard.exe n1 n2");
srand(time(NULL));
printf("%d\n",(int)(((double)rand())/RAND_MAX*(c-d)+0.5)+d);
return 0;
}
par contre, faut le compiler tout seul, je ne peux pas le faire pour toi.
tu le mets dans un fichier hazard.c
et puis
gcc -o hazard.exe hazard.c
AG, d�panneur.
Technical Details
Message-ID:
<42df5f16$0$22531$636a15ce@news.free.fr>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!infeed-2.proxad.net!news16-e.free.fr!not-for-mailReferences:
<dbmgem$2378$1@talisker.lacave.net>Show Full Headers
Complete Article Headers
X-Google-Thread: 10f688,1b9cd5f314610f29 X-Google-Thread: f9822,1b9cd5f314610f29 X-Google-Attributes: gid10f688,gidf9822,public X-Google-Language: FRENCH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!infeed-2.proxad.net!news16-e.free.fr!not-for-mail Date: Thu, 21 Jul 2005 10:49:59 +0200 From: AG <ag@tb.fr> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: fr.comp.os.msdos,fr.comp.lang.c Subject: Re: un generateur de nombre aleatoire sous DOS References: <dbmgem$2378$1@talisker.lacave.net> In-Reply-To: <dbmgem$2378$1@talisker.lacave.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Lines: 32 Message-ID: <42df5f16$0$22531$636a15ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 21 Jul 2005 10:38:46 MEST NNTP-Posting-Host: 83.195.112.130 X-Trace: 1121935126 news16-e.free.fr 22531 83.195.112.130:64338 X-Complaints-To: abuse@proxad.net