Skip to main content

While Loop In C++


A while loop repeat to execute target statement as long as the given condition is true.

Syntax:
      Initialization ;
      While(Final condition){
     Increment/decrements}

Initialization: Read the previous lecture.
Final condition: Briefly explained in previous lecture.
Increment/decrements: Learn more read the previous lecture.





Initialization: in this part of the for loop can declared the starting point of for loop. That’s means initial point of statement execution .in the program the red block are indicate initialization.

Final condition: the end point of program. The ending period  statement execution , that defined by the final condition. In the program the green block are indicate the final condition.

Increment/decrements: The increment operators are use to increases the values of its operand and decrements operators are use to increases the values of its operand. in the program yellow box are indicate increment.

 Click for see flow chart on  while loop


Comments

Popular posts from this blog

Input & Output In C++ (Basic)

Cout<<”Print sentence”;     This statement is use to print out any kinds of sentence or string type values. Cout<<345;     This statement is use to print out any kinds of numeric numbers, without change. Cout<<variable;        This statement is use to print the value of variable. The value of the which variable we want to print, It is need to write that variable on variable place.

Switch, Case, Default Statements In C++

Switch case is uses as alternative of if….else. When we need to use long term of if…else then we use switch case for reducing program execution time. syntax: Switch(variable){ Case value 1: Statement; Break; Case value 2: Statement; Break;

For Loop In C++

A loop can repeat the statement of a particular job continuously for a specific number of times. Loop Description Syntax For The condition can tested before statement execution.   For(Initialization, Final condition, increment /decrements ) { statement; } while First it check the condition then do the job. Initialization; While(Final condition) { Statement; increment /decrements; } Do..while First do job then test the condition. Initialization; Do{ Statement; increment /decrements; } While(Final condition)