The programming languages use some operators and operands to evaluate the values of variables in programs. These operators are the symbols and keywords that are used in every High-level programming language. In this particular blog post, we'll learn about operators operands that are used in C++.
Operators: Operators are the symbols or keywords that are used in programs to perform an operation on the operands.
Type of Operators
- Arithmetic Operators
- Assignment Operators
- Relational Operators
- Logical Operator
- Increment and Decrement Operators
Arithmetic operators are used to perform calculation operations, like addition, subtraction, multiplication, and division on operands. The code example of the arithmetic operators is given below in the figure:
Assignment Operators
The operators that are used to assign the values to the variables are called assignment operators. The value is mentioned on the right side of the variable after the "=" symbol.
Relational Operators
The operators that are used to compare the values of operands are called relational operators. These operators are as follows:
- Equal to (==) operator
- Not equal (!=) operator
- Less than (<) operator
- Greater (>) operator
- Less than or Equal to (<=) operator
- Greater than or Equal to (>=) operator
The logical operators are used to perform logical operations on boolean values. These operators are used to control the flow of statements to make decisions. These operators are as follows:
- Logical And (&&) operator
- Logical Or (||) operator
- Logical Not (!) operator
The increment operator is used to increase the value of the variable by 1(x++ or ++x) or the value mentioned by the programmer. Similarly, the decrement operator is used to decrease the value of the variable by 1(x-- or --x) or the value mentioned by the programmer.
These are the operators in C++.
In this article, we have explained what are the operators in C++, and in the next articles, we'll explain how these can be used in programs.
Comments
Post a Comment