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

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;

do...while loop in C++

The do while loop is very similar to while loop . In the while loop first check final condition then execute the statement. But in the do while loop first execute the statement then check the final condition. Syntax: Initialization; Do{ increment/decrement;   } while(Final condition)

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.