What is C++? What are Operators in C++

What is C++?

C++ is a programming language for indefinite determination. It is commanding object-oriented and generic programming while also providing facilities for low-level memory manipulation. It was designed with a bias towards system programming and embedded resource-constrained.

The large systems with performance efficiency and flexibility of using its configuration highlights. C++ has also been discovered useful in various other contexts with strengths being software infrastructure and resource-constrained applications including desktop application servers.

For example,  e-commerce web search or SQL servers and performance-critical applications.

Like, telephone switches or space probes.

History of C++ Programming Language 

C++ is a language that is compiled and implemented in a certain way that it is available on many platforms and is provided by various organizations including Microsoft and Intel. C++ is systematized by the International Organization for Standardization ISO with the most advanced standard version approved and published by ISO in December 2014.

The current C++ 14 emblem succeeds these and C++ 11 with new features and a large regulation library ere the initial standardization in 1998. C++ was explained by jarns Druce Terp at Beĺl labs since 1979 as an extension of the C language as he wanted an efficient and flexible language similar to C which also provided high-level features for program organization. Many additional programming languages have been affected by C++ including C pound sign java and more current versions of C after 1998.

What Does Operator Mean in C++?

Now being a commanding language it comes up with a few operators,  Coming to the operator, it is a sign that tells the computer to perform specific mathematical or logical manipulations. Now depending on the type of operation, these certain operators are categorized.

Arithmetic Operator

Now suppose variable A holds value 10 and variable B holds 20.

OperatorDescriptionExample
   +Adds two operandsA+B=30
Subtracts second operand from firstA-B= -10
*Multiplies both operandsA*B= 200
/Divides numerator by denominatorB/A= 2
%Modulus operator gives remainder as outputB%A=0
++Increases integer value by 1A++ gives 11
Decreases integer value by 1A– gives 9

 

Assignment Operator

Assuming A holds 10 and B holds 20

OperatorDescriptionExample
=Assigns value from right side operand to the left one.C=A+B
+=Adds right operand to the left and assigns result to the leftA+=B ; A=A + B = 30
-=Subtracts right operand from left and gives result to leftB-= A ; B=B – A = 10
*=Multiplies right operand with left and assigns result to leftA*=B ; A= A * B =200
/=Divides left operand with the right and assigns result to leftB/=A ; B=B / A =2
%=Takes the modulus using 2 operands and assigns the result to the leftB%=A ; B=B % A = 0

 

Relational Operator

Assuming A holds 10 and B holds 20

OperatorDescriptionExample
==Checks if, the two operands are equal or not, if yes then condition becomes trueA==B, is not true
!=Checks if, two operands are equal or not , if not then condition becomes trueA!=B, is true
>Checks if, left operand is greater than right , if yes then condition becomes trueA>B, is not true
<Checks if, left operand is less than right,  if yes then condition becomes trueA<B , is true
>=Checks if, left operand is greater than or equal to right operand , if yes then condition becomes trueA>=B, is not true
<= Checks if, left operand is less than or equal to right, if yes then condition becomes trueA<=B, is true

 

Logical Operator

Assume A holds 1 and B holds 0

OperatorDescriptionExample
&&Called AND operator , if both operands are non zero, then condition becomes trueA&&B , is false
||Called OR operator, if any of the two operands is non zero, then condition becomes trueA||B , is true
!Called NOT operator, used to reverse logical state of its operand. If a condition is true, then NOT can make it false.!(A&&B) , is true

 

Misc Operators

OperatorDescription
sizeofReturns the size of a variable. For example, sizeof (a) ,where a is integer will return 4
Condition ? X : YIf condition is true ? then it returns value X : otherwise value Y

 

You Might Also Want To Read: