Do and Do-While Loop

THE WHILE LOOP while loop can be address as an entry control loop, since the text-expression is present at entry only. Syntax: Initialization; while (condition) { // code block to be executed updation; } In a while loop initialization must be done outside the loop. Remember, while statement should not be terminated. Example int Read more…

For loop in c++/c/cpp

It is the iterative statement, through which we can execute a set of instructions repeatedly. Syntax:- for(initialization expression(s); test-expression;update-expression) { //Body of loop; } Let’s understand all terms one by one: Initialization expression(s): It initialize the loops control variable. It tells the compiler about the number of times the loop Read more…

Switch statement in C++

SWITCH STATEMENT C++ provide a multiple-branch selection statement known as switch.It tests the value of an expression/condition against a list of integers or character constant.On matching associated statements are executed. Syntax:- switch(expression) { case constant1:statement1; break; case constant2:statement2; break; case constant3:statement3; break; : : : case constant n:statement n; break; Read more…

If Else Statement in C++

It is the first selection statement. It checks a particular condition, if condition evaluates to be true course-of-action is performed, it gets ignored. Syntax: if(condition) Statement; where a statement can be a single statement or a compound statement(sequence of statement enclosed in a pair of ‘{}’)or nothing. Remember, not to Read more…