Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

The Operator in C++ Programming language

Posted on October 3, 2017January 24, 2020

Table of Contents

  • The operator in C++ Programming language
  • C++ operators
    • Arithmetic Operator in C++
    • 2. Unary Operator in C++
    • 3. Assignment Operator
    • 4. Relational Operator
    • 5. Logical Operator
    •  6. Bitwise Operator

The operator in C++ Programming language

In this tutorial, we will discuss the Operator in C++ Programming language.

C++ operators

Many types of operators are available in java that is used to perform various operations.
Type of C++ operators given below

  1. Arithmetic Operator
  2. Unary Operator
  3. Assignment Operator
  4. Relational Operator
  5. Bitwise Operator
  6. Logical Operator
  7. Ternary Operator

Arithmetic Operator in C++

Arithmetic Operators are used for basic arithmetic calculations like addition(+), subtraction(-), multiplication(*), division(/) and modulus(%) operations

This table lists the arithmetic operators used in c ++ Programming language

operator in c++
Arithmetic

Example

operator in c++
Example

When we executed the above program, it produced the following result.

addition of a+b : 32
subtraction of a-b: 8
multiplication of a*b is: 240 
division  a/b is: 1
modulus of a%b is: 8

2. Unary Operator in C++

The unary operators in C++, “-” ,”+” operators change the sign of a given value.

The “++” and the “–” operators perform increment or decrement by one from the given value.

operator in c++
unary

 

Example

operator in c++
Example

When we executed the above program, it produced the following result

a++ value is :12
a--  value is: 13
++a value is: 13
--a value is: 12

3. Assignment Operator

The assignment operator is used to assign value to a variable. Assignment operator passes the value at the right side of the operator into the left side variable.

operator in c++
assignment

Example 1

operator in c++
Example

 

When we executed the above program, it produced the following result
In b=a,b value is: 12
In b+=a,b value is: 24
In b-=a,b value is: 12
In b*=a,b value is: 144
In b/=a,b value is: 12
In b/=a,b value is: 0

4. Relational Operator

In C++ programming, the relational operator can be used to compare values stored in two variables.

Six types of the relational operator that are commonly used in C++.

operator in c++
Relational
operator in c++
Example

5. Logical Operator


Logical operators are used to comparing more than one condition. The following table displays the different c++ logical operators that are available.

 

operator in c++
Example
operator in c++
Example

When we execute the above program, it  produced the following result

You are not a students

 6. Bitwise Operator

The bitwise operator is used to do the bit-level calculation. Various bitwise operators are available in C++for manipulation of bits.   C++ bitwise operators operate on integer and character data type only.

operator in c++
Bitwise
Program
operator in c++
Example

When we executed the above program, it produces the following result

value of a & b is: 1
value of a | b is: 21
value of a ^ b is: 20
value of a << b is : 20
value of a >> b is : 2
Similar post
Operator in Java
Operator in C
Operator in Python

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes