Skip to main content

Programming Fundamental: Operators and Operands in C++

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

  1. Arithmetic Operators
  2. Assignment Operators
  3. Relational Operators
  4. Logical Operator
  5. Increment and Decrement Operators
Arithmetic 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:

  1. Equal to (==) operator
  2. Not equal (!=) operator
  3. Less than (<) operator
  4. Greater (>) operator
  5. Less than or Equal to (<=) operator
  6. Greater than or Equal to (>=) operator
Logical Operators

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:

  1. Logical And (&&) operator
  2. Logical Or (||) operator
  3. Logical Not (!) operator 
Increment and Decrement Operators

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

Popular posts from this blog

Programming Fundamental: Datatypes and Variable Declaration

In every programming language, there are some key elements are used. These key elements are the building blocks of any programming language. In this particular blog post, we will discuss about two of them. These are as follows: Variables Data Type     What is a Variable? A variable is like a labeled box in a computer's memory (RAM) where you can store information. It's given a specific name to help you access and manipulate the stored data during program execution. These stored values can change as the program runs. Variable Declaration   Variable declaration is the process of specifying the data type a variable will hold. Data types define the kind of data a variable can store, such as numbers, text, or other types. Variable Initialization Variable initialization involves assigning an initial value to a variable during its declaration or at a later point in the program. The following picture will display the example of the variable declaration and initialization. What is...