Home » Science » Computer Science » Archive by category "Programming in C++"

What is Increment and Decrement Operators

Increment and Decrement Operators C++ provides two Unary Operators for incrementing and decrementing variables values by 1. Increment Operator ++ Decrement Operator  — These Operators operate on one Operand and used in two modes. 1)      Postfix Mode 2)      Prefix Mode Postfix Mode: When increment and Decrement operator appear after the operands, the corresponding operation is called Postfix Increment and Postfix Decrement. Postfix increment and decrement are performed on the basis of...
Continue reading »

How to use conditional operator in c++.

Conditional Operator The conditional operator is also called Ternary Arithmetic Operator as it takes 3 Operands. We can use the conditional operator to create short expression that works like if/else statements. The operator consists of the question-mark (?) and the colon (:). The syntax is given below: Syntax: Conditional expression? True expression: False expression Example:             a < 0 ? b = 100 : c = 200 ;                                 It works like If-Else...
Continue reading »