delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/18/22:00:47

From: "Mauro Guico" <lpjr20 AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Implicit what?
Date: Mon, 18 Oct 1999 19:34:19 -0500
X-Posted-Path-Was: not-for-mail
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-ELN-Date: 19 Oct 1999 00:34:31 GMT
X-ELN-Insert-Date: Mon Oct 18 17:35:22 1999
Organization: EarthLink Network, Inc.
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MSMail-Priority: Normal
Lines: 31
NNTP-Posting-Host: dialup-166.90.64.2.chicago1.level3.net
Message-ID: <7ugean$5qv$1@birch.prod.itd.earthlink.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

    Just to let everyone know, I've been at this for about two months now
(since the start of school) and I'm looking forward to learning beyond the
class. (I have a lot of spare time sitting there during the period.) So I
drew up a random number function that's given in all the examples of
rand()...

file://random.cc

#include <iostream.h>
#include <iomanip.h>
#include <random.h>
#include <time.h>

int main()
{
srand(time(0));
int randnum = 101;
cout << rand()%randnum << '\n';
getchar();
return 0;
}

and that's it. Simple enough, so I'd thought. Now, it might sound like a
pretty dumb question (though I know, there are no dumb questions) but when I
compile this, it is fine, yet when I try to run it, I get hit with an
'implicit declaration of function 'int srand(...)'' and the same for
'rand(...)' What's up with it? Thanks to everyone who reads this!

~Rob



- Raw text -


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