Monthly Archives: September 2021

09. C++ switch statement

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each case. Syntax The syntax for a switch statement in C++ is as follows − switch(expression) { case constant-expression : statement(s); break; //optional case constant-expression : statement(s); break;… Read More »

08. AND, OR & NOT

Logical Operators There are following logical operators supported by C++ language. Logical operators are used to determine the logic between variables or values: Operator Name Description Example &&  Logical and Returns true if both statements are true x < 5 &&  x < 10 ||  Logical or Returns true if one of the statements is… Read More »

07. C++ Conditions and If Statements

C++ supports the usual logical conditions from mathematics: Less than: a < b Less than or equal to: a <= b Greater than: a > b Greater than or equal to: a >= b Equal to a == b Not Equal to: a != b You can use these conditions to perform different actions for different decisions. C++ has the following… Read More »