From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Loops Date: Sat, 30 Nov 1996 01:04:34 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 34 Message-ID: <329FF8A2.7EC7@cs.com> References: <01bbde81$ba443400$0116a5ce AT pentium-133> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp102.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Mike McLean DJ-Gateway: from newsgroup comp.os.msdos.djgpp Mike McLean wrote: > > sorry to bother again, but how do I do IF Then and while do loops? > > any help is appreciated if ( condition ) while ( condition ) statement(s); statement(s); else statement(s); If more than one statement, you need to enclose them in braces, eg.: int x = 4, y = 10; while ( x < y ) { if ( y - x > 4 ) x += 2; else x += 1; printf( "x = %d, y = %d\n", x, y ); } PLEASE find a good C book or class and curl up with it. This newsgroup is not here to answer basic questions about the language. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Proud owner of what might one | http://www.cs.com/fighteer | | day be a spectacular MUD... | Plan: To make Bill Gates suffer | ---------------------------------------------------------------------