cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/11/14:51:49

From: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: I can't seem to get this to work!
Date: 11 Jan 1999 18:27:26 GMT
Organization: University of Lulea, Sweden
Lines: 39
Message-ID: <77dfqe$6d1$4@news.luth.se>
References: <3699E931 DOT A63558C6 AT erols DOT com>
NNTP-Posting-Host: queeg.ludd.luth.se
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jason Mullins (cyberj23 AT erols DOT com) wrote:
: Hello -
:     Im new to programming.  I wondering why I can't get this code to
: count backwards form 6 to 0 and exit.  I will start at 6, and go down to
: negitives (becuase it's a "int").  I was told that it could be done in a
: while loop.  not a do while.  Any suggestions?

It can be done in a do while too.

: Thanx in advance.
: 
: Jason Mullins
: 
: #include <stdio.h>
: 
: int main()
: {
: int count;
: int cycle;
:     cycle = 0;
:     count = 6;
:     while (count <= 6, cycle = 6)

Try "while(0 <= count)" instead. Or "while(cycle <= 6)" Or even
"while(count*2 + 5*M_PI - cycle, !(7 <= count))" if you are feeling
adventurous! 

:     {
:         printf("The value of count is %d\n");
:         count = count--;
:         cycle = cycle++;
:      }
:      return 0;
: }


Right,

							MartinS

- Raw text -


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