c++ while loop

explanation of while loop statement

Page 1 of 1

3 Replies - 3132 Views - Last Post: 12 April 2010 - 05:56 AM Rate Topic: -----

#1 hilals  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 10

c++ while loop

Posted 12 April 2010 - 02:32 AM

what does while loop do, syntax of while loop, some examples of while loop a long with the output?
Is This A Good Question/Topic? 0
  • +

Replies To: c++ while loop

#2 aniri  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 54
  • View blog
  • Posts: 657
  • Joined: 24-November 09

Re: c++ while loop

Posted 12 April 2010 - 02:42 AM

This is a good tutorial on loops:
tutorial
Was This Post Helpful? 0
  • +
  • -

#3 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 990
  • Joined: 30-July 08

Re: c++ while loop

Posted 12 April 2010 - 02:48 AM

It run the code inside it's body while a statement is true.
while(x != 1) { /* do this */ }
If x becomes 1 it stops. This is covered in on of the 1-2 chapters (depending on book and what it cover first) in your course/programming book.

It's pretty much the same as a if-statment only that it ain't run just one time it's run as long as the statement inside ( ) is false

This post has been edited by FrozenSnake: 12 April 2010 - 02:50 AM

Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5960
  • View blog
  • Posts: 23,238
  • Joined: 23-August 08

Re: c++ while loop

Posted 12 April 2010 - 05:56 AM

And if you'd just glanced over to the right you would have seen a link to Understanding Loops in C++ under the C++ Tutorials banner in the sidebar!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1