X-WM-Posted-At: MailAndNews.com; Tue, 21 Aug 01 20:56:51 -0400 X-WebMail-UserID: Ramiman12 Date: Tue, 21 Aug 2001 20:56:51 -0400 Sender: Ramy Elmeligy From: Ramy Elmeligy To: djgpp AT delorie DOT com X-EXP32-SerialNo: 50000000 Subject: loop/continue problem Message-ID: <3B8D1069@MailAndNews.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: InterChange (Hydra) SMTP v3.61.08 Reply-To: djgpp AT delorie DOT com OK, i have another question. This a program i wrote for a simple excercise, given in Ivor Horton's Beginning C++. Its supposed to output numbers from 1 to 30, except for those which are divisible by 3 or 5, using either a for, while, or do-while loop. This seems as if it should work fine, but the program outputs all numbers from one to 30, not excluding those it should. #include #include using namespace std; int main() { int count = 0; for(int number = 0 ; count <= 30 ; number++) { count++; if(number / 3 == 0 || number / 5 == 0) //i suspect the problem is here continue; else cout << number << endl; } return 0; } I've tried removing the continue, and putting an '!' in front of the statements inside the 'if', then making it so 'cout << number' only executes when it is false, and that produced the same results! what is going on here? ------------------------------------------------------------ Get your FREE web-based e-mail and newsgroup access at: http://MailAndNews.com Create a new mailbox, or access your existing IMAP4 or POP3 mailbox from anywhere with just a web browser. ------------------------------------------------------------