Use them carefully.
Control statements are statements that alter the flow of execution according to the evaluation of an expression (the condition). The C++ control statements are ifstatements, switch statements and the tertiary conditional operator, ?:.
Unconditional statements are statements that are invoked unconditionally. Conditional statements have a controlling expression, while unconditional statements do not. For example: void f (bool b) { if (b==true) do_something(); // conditional statement (controlled by the expression b==true) do_something_else(); // unconditional (executes regardless of b's value) }
The C programming language is generally made up of common conditional statements. Occasionally, unconditional statements such as test that are based on imperative commands.
Decision making statements make use of conditional expressions. In C++ there are three possibilities: if/else, switch/case and the ternary operator (?:).
Statements that check an expression then may or may not execute a statement or group of statements depending on the result of the condition.
Control instructions are instructions that alter the flow of execution. In C++ this include if, if-else statements, switch-case statements and the conditional ternary operator (?:), as well as loop structures (for, while, do-while) and procedural goto statements.
#include<stdio.h> void main() { int a=10,b=15; clrscr(); if(a>b) printf("%d is the large number",a); else printf("%d is the large number",b); getch(); }
In the C language, the continue statement can only be used within a loop (for, while, or do). Upon execution, control transfers to the beginning of the loop.
An unconditional goto is a goto that has no associated conditional expression. The following example demonstrates conditional and unconditional goto statements. int x=rand(); if (x) goto label_1; // conditional goto (when x is non-zero) else goto label_2; // conditional goto (when x is zero) label_1: // ... goto label_3; // unconditional goto (jump past label_2) label_2: // ... label_3: // ...
Yes.
All statements must be terminated with a semi-colon in C.
if is a conditional statement to check the given condition