delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/31/17:10:17

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random numbers, 'or ' and 'and' ;
Date: Sat, 31 Oct 1998 14:00:55 -0800
Organization: Alcyone Systems
Lines: 26
Message-ID: <363B8897.51E0EE99@alcyone.com>
References: <01be0514$a99ee440$2e884fd1 AT default>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.34 i686)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Oliver Batchelor wrote:

> I am writing a rts game.  full code below.

When having difficulties, please do not post your entire source code. 
This is a waste of time and space and practically ensures that no one
will read it.  Always limit trouble code to the smallest reproducible
program that exhibits the behavior.

> 1: I cannot find out how to use and  or  or  in an if statement

The logical and operator in C is &&; the logical or operator is ||.  I
suggest you pick yourself up a good book on C.

> 2: I cant seem to find a procedure that makes random numbers.

Use rand and srand (ANSI), or random and srandom (DJGPP-specific).

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / Custom reconciles us to everything.
           / Edmund Burke

- Raw text -


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