while statement

   
while statement Test-at-top unbounded loop statement

  statement  := while (  condition  )  statement   condition  ::=  expression   type-specifier-seq   declarator  =  assignment-expr  

The while loop tests condition , and if condition is true, while executes statement . This repeats until condition is false. If condition contains a declaration, the declaration is in the same scope as statement .

Example

  while  (cin >> num)   data.push_back(num); 

See Also

break , continue , do , expression , for , statement , Chapter 4

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net