C++ if-else-if ladder statement

This statement allows the user to have multiple options to check for different conditions. Here, if one of the if or else-if condition is true then that part of the code will be executed and the rest will be skipped. if none of the conditions are true then the final else statement present at the … Read more

C++ nested if statement

This statement allows the user to use if block inside the other if block. And the inner if statement is executed only if the outer if statement’s condition is true. The syntax of the nested if statement in C++: You can also nest the if..else statement in same manner as shown below. nested if statement Flowchart: Example … Read more

C++ if…else statement

If the Boolean expression is true then the code inside the if statement block is executed or if it is false then the code inside else statement will be executed. Hence if..else statement. The syntax of the if..else statement in C++: If…else Flowchart: Example of if…else statement in C++ The output of if…else statement in C++.

C++ if Statement

An if statement consists of a Boolean expression followed by one or more statements. If the Boolean expression is true, the block of code inside the if statement will be executed else not. This is most simple of all the decision making statements. The syntax of the if statement in C++: If the condition is evaluated true, block of … Read more

Type Conversion in C++

C++ programming allows us to convert the variables from one data type to another. A type cast basically means the conversion of one data type to another. There are two types of conversion in C++: Implicit Conversion Explicit Conversion (or type casting) Implicit Conversion Implicit type conversion which is also known as ‘Automatic type conversion’, … Read more

C++ Increment and Decrement Operators

Increment and Decrement Operators are the Unary Operators as they operate on a single operand. They are ++ and — operators. ++ is used to increase the value by 1 and — is used to decrease the value by 1. There are two kinds of Increment and Decrement Operators. Post-Increment or Post-Decrement:First, the value is … Read more

C++ Arithmetic Operators

Arithmetic Operators the symbols that are used to perform mathematical operations on operands such as addition, subtraction, multiplication, division etc. operator description + additionadds two operands. eg, a+b. – subtractionsubtracts two operands. eg, a-b. * multiplicationmultiplies two operands. eg, a*b. / divisiondivides the operand by the second. eg, a/b. % moduloreturns the remainder when the … Read more

C++ Assignment Operators

Assignment operators are used in a program to assign a value of the right-hand side to the left-hand side as shown below. These are the short version formed by combining the two operators. For example Instead of writing, int a = a+5, we can write a += 5. Following are the list of assignment operators used in … Read more

C++ Relational Operators

These operators are used to compare two values and return Boolean results. For example: it checks if the operand is equal to another operand or not or an operand is greater than the other operand or not or check less than between two values, etc. List of C++ relational operators: Operator Name Example == Equal … Read more

C++ Logical Operators

Logical Operators are used in conditional statements and loops for evaluating a condition with binary values. They are used to combine two different expressions together. The following are the C++ Logical Operators. Assume X holds the value 1 and Y holds 0 Operator Description Example && (logical and) If both the operands are non-zero, then … Read more