May 08, 2013 alguien k sea pro en dev c k AYUDEE xf. Para la empresa tecnologica de la nube s.a, permita calcular la cancelacion diaria a un total de n personas ingresadas por teclado,a quienes debe cancelar por horas extras trabajadas. La hora trabajada se pauto en $15. La cantidad de horas trabajadas diarias es 8. La hora extra se pauto en $20.
-->Executes a statement repeatedly until the specified termination condition (the expression) evaluates to zero.
Syntax
Remarks
The test of the termination condition is made after each execution of the loop; therefore, a do-while loop executes one or more times, depending on the value of the termination expression. The do-while statement can also terminate when a break, goto, or return statement is executed within the statement body.
The expression must have arithmetic or pointer type. Execution proceeds as follows:
- The statement body is executed.
- Next, expression is evaluated. If expression is false, the do-while statement terminates and control passes to the next statement in the program. If expression is true (nonzero), the process is repeated, beginning with step 1.
Example
The following sample demonstrates the do-while statement:
Dev C++ Online
See also
Iteration Statements
Keywords
while Statement (C++)
for Statement (C++)
Range-based for Statement (C++)
Keywords
while Statement (C++)
for Statement (C++)
Range-based for Statement (C++)
- C++ Basics
- C++ Object Oriented
- C++ Advanced
- C++ Useful Resources
- Selected Reading
A while loop statement repeatedly executes a target statement as long as a given condition is true.
Syntax
The syntax of a while loop in C++ is −
Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non-zero value. The loop iterates while the condition is true.
When the condition becomes false, program control passes to the line immediately following the loop.
Flow Diagram
Ciclo While En Dev C++ Ejemplos
Here, key point of the while loop is that the loop might not ever run. When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.
Example
When the above code is compiled and executed, it produces the following result −
Do While Dev C++ Ejemplos
cpp_loop_types.htm