Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Operators
Concept Notes and Resources
Concept Learning Code Sheets

Operators based on operand count #1728

Binary, unary and ternary operator classification is based on number of operands.

Operators for assignment #1734

Here we demonstrate the simple assignment and its variations.

Operators for comparison #1736

Using operators for equality, inequality, greater, lesser, greater or equal, lesser or equal types of comparisons.

Operators for logical use #1739

Testing the use of logical operators like not, and and or operators.

Comma as operator #1741

Comma is a sort of operator which can help form multiple instructions within same instruction.

Bitwise operators #1743

Bit-wise operators work after the given operands are converted to their binary equivalent value.

Typecasting operator #1745

Typecasting or conversion of data type is some times essentially required. This is also a kind of operator in c++

Typecasting while outputting #1747

Type casting is often useful for manipulating display while outputting data.

sizeof operator #1750

Datatype size is found by using the sizeof operator in c++

Simple case of precedence #1752

The order in which operators are applied on operands in an expression can be understood with this example.

Operator precedence with value change within expression #1784

Learning operator precedence case when value changes while evaluating the expression.

Age based discount using ternary operator #2318

Solving age based discount problem with ternary (three operands) operator.

Largest of three numbers using nested ternary operator #2943

A program to demonstrate nesting of ternary operator while finding the largest of three numbers.

 

Modulus operator for integers #3589

Getting the remainder of an integer division using the modulus operator.

Assignment operator chain #5511

Here we demonstrate the assignment done in a chain fashion.

Multiple value assignment attempts #5571

Here we demonstrate the treatment of precedence between comma, brackets and assignment operator in a multiple value assignment scenario.


Solved Problems

Increment, Decrement Composite Operators Problem 1 #1756

Show the output of the following program. Assume that required header files a

Show the output of the following program. Assume that required header files are present.

int main()
{
  int n=10;
  cout<< n << endl ;
  cout<< ++n << endl ;
  cout<< n++ << endl ;
  cout<< n << endl ;
  cout<< - n << endl ;
  cout<< - - n << endl ;
  cout<< -- n << endl ;
  cout<< n << endl ;
  cout<< n-- << endl ;
  cout<< n << endl ;
  cout<< - --n <<endl;
  cout<< (n+=1) <<endl;
  cout<< (n-=1) <<endl;
  cout<< (n%=2) <<endl;
  return 0 ;
}

Assignment, equality comparison problem #2314

Find the output of the program given below. Assume all relevant header files

Find the output of the program given below. Assume all relevant header files are included

int main( )
{
  int a,b,c=101,d=102;
  a=(c=d);
  cout<<a<<endl;
  b=(c==d);
  cout<<b<<endl;
  return 0 ;
}

Output of a ternary operator operation #2321

Write output of the following program using the ternary operation logic.

Write output of the following program using the ternary operation logic.

#include <iostream.h>
int main()
{
  int a=10,b=23;
  int c=a>b?a=b:b=a;
  cout<<c<<endl;
  return 0;
}

Ternary operator within cout chain for selective printing #2791

Initialise a character variable. Now using the ternary operator within the co

Initialise a character variable. Now using the ternary operator within the cout chain of printing, print YES if initialised variable is Y and print NO if it is anything else.

Output Writing – Logical Operators #3215

Write the output of the following program and explain.

int main( )

Write the output of the following program and explain.

int main( )
{
int a=1,b=0;
int c=!a && b;
cout<<(c || b+a)<<endl;
cout<<(-c && a+b)<<endl;
return 0 ;
}

Finding Valid Multiple value assignments #5573

Which of the following statements is/are valid and why.
int x;

(

Which of the following statements is/are valid and why.
int x;

(i)  x=1,024;

(ii) x=(1,024);

 

Practice Problem
Quizzes

Concept Notes:1  Code Sheets:16  Solved Problems:6  Practice Problems:2  Quizzes:3
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning 2D Array Memory Addressing Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Multi-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back