Operators and their expression in cpp, C/C++ Programming

Assignment Help:

Operators in C++:

All C operators are valid operators in C++ also.  Besides C++ has developed some new operators like

Operators and their Expression:

1.      Logical operator

2.   Assignment operator: Variable must be declared before assigning. Chain Assignment Ex: x=y=z;

Embedded Assignment Ex: x=(y=10)+10;

Compound or Shorthand Assignment: x = x+y is x +=y; Dynamic initialization Ex: int x=strlen("apple");

Static initialization Ex int x=100;

3.   Reference variable: Ex: int &x=y; x is alias of y.

4.   Relation operator

5. Arithmetic operator

6 Increment and Decrement operator

7 Special operator.

8 Conditional operator.

9 Bitwise operator.

10. Type cast operator: Ex: x =float(a)/float(b).

11. Scope Resolution operator: Ex: :: to access from global variable and class.

12. Insertion and Extraction operator: << and >>.

13. Class Member dereferencing operator:

1 :: To declare pointer to a member in class.

2 ->*  To access pointer member when both class and member have pointers

3 .*     To access pointer member when only member has pointer.

14. Memory  Management  Operator:  new  and  delete.   The  variable  must  be  pointer

variable. In malloc, calloc, realloc, free are used. int *ptr;  ptr = new int;

ptr = new int(25); assigning value delete ptr;  release the memory of ptr.

 

int *ptr; ptr = new int[10];

delete []ptr; release the memory or array pointer.

 

15. Manipulator Ex: endl work like \n and setw(10) set width for the variable cout<<setw(10)<<x<<endl<<setw(10)<<y.

16. Implicit Expression: Conversion is implied from lower to higher order of primary

data type.

17. Operator overloading: Ex: << and >>


Related Discussions:- Operators and their expression in cpp

Integration, w.a.p to find outWrite a program to find the area under the cu...

w.a.p to find outWrite a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

What is some reward/drawback of using friend functions?, A: They present a ...

A: They present a degree of freedom in the interface design options. Member functions & friend functions are equally privileged (100% vested). The major difference is that a fri

I need website product section search box coding section fix, I need websit...

I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

C++, Byteland county is very famous for luminous jewels. Luminous jewels ar...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Write a program that finds the minimum total number of shelv, At a shop of ...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Program of sorting algorithms , The program sorting.cpp contains a main f...

The program sorting.cpp contains a main function for testing the operation of several sort algorithms over various data sizes and data set organisations. The program understands

C++, Write C++ code for calculating the time table

Write C++ code for calculating the time table

Pointer to function, how many values we can return from pointer to function...

how many values we can return from pointer to function?

Asset pricing project, In the final project assignment you are asked to dev...

In the final project assignment you are asked to develop an OOP C++ class hierarchy for derivative pricing, using the binomial tree and Black-Scholes option pricing methods. You wi

Inheritance and polymorphism, The zipped folder int_collection.zip (downloa...

The zipped folder int_collection.zip (downloaded from Blackboard) contains an abstract class AbstractIntCollection and two interfaces: IntList and IntStack. The abstract class cont

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd