SlideShare a Scribd company logo
1 of 21
C++ Language 
By:-AAKASH KAUSHIK 
#9289817971, 98919893083 
Email-theaakashkumar@gmail.com
UNIT -4 
OPERATORS & 
EXPRESSIONS
OPERATORS 
An operator is a symbol that tells the compiler 
to perform specific mathematical or logical 
manipulations. 
operators operates on some data to give 
results 
For ex :- A+B=C 
Here A, B are operands and + is the 
operator which produces C as a result of addition 
of A and B. 
AAKASH KAUSHIK 
9891983083,9289817971
CLASSIFICATION OF OPERATORS 
Based on the no. of operand needed for 
operation operators can be broadly classified into 
3 categories. 
UNARY OPERATORS 
BINARY OPERATORS 
TERNARY OPERATORS 
AAKASH KAUSHIK 
9891983083,9289817971
UNARY OPERATORS 
The unary operators operate on a 
single operand
UNARY PLUS(+) & UNARY MINUS(-) 
UNARY (–) MINUS – used to represent –ive 
values. 
ex.:- -5,-50,-3.14 etc. 
UNARY (+) PLUS – used to represent +ive 
values. 
ex.:- +5,+50,+3.14 etc. 
In C++ by default values are considered as +ive 
so no need to explicitly use UNARY (+)PLUS. 
AAKASH KAUSHIK 
9891983083,9289817971
INCREMENT/DECREMENT OPERATOR 
Increment operator increases integer value by one. 
For ex.:- 
int a=10; 
a++; //will give 11 
Decrement operator decreases integer value by one. 
For ex.:- 
int a=10; 
a--; //will give 9 
AAKASH KAUSHIK 
9891983083,9289817971
BINARY OPERATORS 
The Binary operator takes 2 
arguments.
TYPE OF BINARY OPERATORS 
ARITHMETIC OPERATORS 
RELATIONAL OPERATORS 
LOGICAL OPERATORS 
AAKASH KAUSHIK 
9891983083,9289817971
ARITHMETIC OPERATORS 
Arithmetic operators are used for mathematic 
calculations. 
AAKASH KAUSHIK 
9891983083,9289817971
RELATIONAL OPERATORS 
A relational operator compares two operands to 
determine whether one is greater than, greater 
than or equal to, less than, less than or equal to 
the other. 
If the condition is true, it will return non-zero 
value, if the condition is false, it will return 0. 
AAKASH KAUSHIK 
9891983083,9289817971
RELATIONAL OPERATORS 
AAKASH KAUSHIK 
9891983083,9289817971
LOGICAL OPERATORS(AND,OR,NOT) 
Logical operators are used in situation when 
we have more then one condition in a single 
statement. 
The logical operators && and || are used when 
evaluating two expressions to obtain a single 
relational result. 
The logical operator ! Is used for negation 
purpose. Basically, it returns the opposite 
Boolean value of evaluating its operand. 
AAKASH KAUSHIK 
9891983083,9289817971
LOGICAL OPERATORS 
AAKASH KAUSHIK 
9891983083,9289817971
TERNARY OPERATORS 
THE ONE AND ONLY TERNARY 
OPERATOR IS CONDTIONAL 
OPERATOR( ? : )
CONDITIONAL OPERATOR 
The conditional operator is also known as 
ternary operator. It is called ternary operator 
because it takes three arguments. First is 
condition, second and third is value. The 
conditional operator check the condition, if 
condition is true, it will return second value, if 
condition is false, it will return third value. 
Syntax:- 
val = condition ? val1 : val2; 
AAKASH KAUSHIK 
9891983083,9289817971
TERNARY OPERATOR USAGE 
EXAMPLE 
#include<iostream.h> 
#include<conio.h> 
void main() 
{ 
clrscr(); 
int x=5,y=2,lrg; 
lrg = (x>y) ? x : y; 
cout<<"nlargest number is : "<<lrg; 
getch(); 
} 
Output : Largest number is : 5 
AAKASH KAUSHIK 
9891983083,9289817971
SOME MORE SPECIAL OPERATORS 
SIZEOF & COMMA OPERATOR
SIZEOF OPERATOR 
The sizeof is a compile time operator, and used 
with an operand, it returns the number of bytes 
the operand occupies. The operand may be a 
variable, a constant or a data type qualifier. 
m=sizeof(sum); 
n=sizeof(long int); 
k=sizeof(235L); 
AAKASH KAUSHIK 
9891983083,9289817971
COMMA OPERATOR(,) 
The comma operator (,) is used to separate two 
or more expressions that are included where 
only one expression is expected. When the set of 
expressions has to be evaluated for a value, only 
the right-most expression is considered. 
For example, the following code: 
a = (b=3, b+2); 
would first assign the value 3 to b, and then 
assign b+2 to variable a. So, at the end, 
variable a would contain the value 5 while 
variable b would contain AAKASH KAUSHIK 
value 3. 
9891983083,9289817971
THANK 
YOU 
AAKASH KAUSHIK 
9891983083,9289817971

More Related Content

What's hot (20)

Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptx
 
Relational model
Relational modelRelational model
Relational model
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
HTML Frameset & Inline Frame
HTML Frameset & Inline FrameHTML Frameset & Inline Frame
HTML Frameset & Inline Frame
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
MySQL JOINS
MySQL JOINSMySQL JOINS
MySQL JOINS
 
MYSQL using set operators
MYSQL using set operatorsMYSQL using set operators
MYSQL using set operators
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Sql DML
Sql DMLSql DML
Sql DML
 

Similar to c++ programming Unit 4 operators

This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxranaashutosh531pvt
 
c++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesc++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesAAKASH KUMAR
 
Report Group 4 Constants and Variables
Report Group 4 Constants and VariablesReport Group 4 Constants and Variables
Report Group 4 Constants and VariablesGenard Briane Ancero
 
Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Genard Briane Ancero
 
Project in TLE
Project in TLEProject in TLE
Project in TLEPGT_13
 
Operators
OperatorsOperators
OperatorsKamran
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programmingsavitamhaske
 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++Praveen M Jigajinni
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)jahanullah
 

Similar to c++ programming Unit 4 operators (20)

operators.pptx
operators.pptxoperators.pptx
operators.pptx
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptx
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
c++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesc++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data types
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Report Group 4 Constants and Variables
Report Group 4 Constants and VariablesReport Group 4 Constants and Variables
Report Group 4 Constants and Variables
 
Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)
 
Partial Derivatives.pdf
Partial Derivatives.pdfPartial Derivatives.pdf
Partial Derivatives.pdf
 
Project in TLE
Project in TLEProject in TLE
Project in TLE
 
C PRESENTATION.pptx
C PRESENTATION.pptxC PRESENTATION.pptx
C PRESENTATION.pptx
 
C++ chapter 2
C++ chapter 2C++ chapter 2
C++ chapter 2
 
Operator in c
Operator in cOperator in c
Operator in c
 
Operators
OperatorsOperators
Operators
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++
 
Operators
OperatorsOperators
Operators
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
3306617
33066173306617
3306617
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 

More from AAKASH KUMAR

NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...AAKASH KUMAR
 
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CSAAKASH KUMAR
 
Inheritance question
Inheritance questionInheritance question
Inheritance questionAAKASH KUMAR
 
Header file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THHeader file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THAAKASH KUMAR
 
Constructor & destructor based question- cbse cs class 12th
Constructor & destructor based question-  cbse cs class 12thConstructor & destructor based question-  cbse cs class 12th
Constructor & destructor based question- cbse cs class 12thAAKASH KUMAR
 
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMCHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMAAKASH KUMAR
 
Practical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thPractical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thAAKASH KUMAR
 
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CSAAKASH KUMAR
 
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...AAKASH KUMAR
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...AAKASH KUMAR
 
Inheritance question class 12th
Inheritance question class 12thInheritance question class 12th
Inheritance question class 12thAAKASH KUMAR
 
Power point2007instruction
Power point2007instructionPower point2007instruction
Power point2007instructionAAKASH KUMAR
 
Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2AAKASH KUMAR
 
Evolution / history of Computer
Evolution / history of ComputerEvolution / history of Computer
Evolution / history of ComputerAAKASH KUMAR
 
Array within a class
Array within a classArray within a class
Array within a classAAKASH KUMAR
 
Input Output Devices and Memory Unit
Input Output Devices and Memory UnitInput Output Devices and Memory Unit
Input Output Devices and Memory UnitAAKASH KUMAR
 

More from AAKASH KUMAR (20)

NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
 
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
 
Inheritance question
Inheritance questionInheritance question
Inheritance question
 
Header file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THHeader file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12TH
 
Constructor & destructor based question- cbse cs class 12th
Constructor & destructor based question-  cbse cs class 12thConstructor & destructor based question-  cbse cs class 12th
Constructor & destructor based question- cbse cs class 12th
 
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMCHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
 
Practical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thPractical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12th
 
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
 
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
 
Inheritance question class 12th
Inheritance question class 12thInheritance question class 12th
Inheritance question class 12th
 
Ms word Part 2
Ms  word Part 2Ms  word Part 2
Ms word Part 2
 
Ms word Part 1
Ms  word Part 1Ms  word Part 1
Ms word Part 1
 
Power point2007instruction
Power point2007instructionPower point2007instruction
Power point2007instruction
 
Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2
 
Html Slide Part-1
Html Slide Part-1Html Slide Part-1
Html Slide Part-1
 
Evolution / history of Computer
Evolution / history of ComputerEvolution / history of Computer
Evolution / history of Computer
 
computer system
computer system computer system
computer system
 
Array within a class
Array within a classArray within a class
Array within a class
 
Input Output Devices and Memory Unit
Input Output Devices and Memory UnitInput Output Devices and Memory Unit
Input Output Devices and Memory Unit
 

Recently uploaded

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

c++ programming Unit 4 operators

  • 1. C++ Language By:-AAKASH KAUSHIK #9289817971, 98919893083 Email-theaakashkumar@gmail.com
  • 2. UNIT -4 OPERATORS & EXPRESSIONS
  • 3. OPERATORS An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. operators operates on some data to give results For ex :- A+B=C Here A, B are operands and + is the operator which produces C as a result of addition of A and B. AAKASH KAUSHIK 9891983083,9289817971
  • 4. CLASSIFICATION OF OPERATORS Based on the no. of operand needed for operation operators can be broadly classified into 3 categories. UNARY OPERATORS BINARY OPERATORS TERNARY OPERATORS AAKASH KAUSHIK 9891983083,9289817971
  • 5. UNARY OPERATORS The unary operators operate on a single operand
  • 6. UNARY PLUS(+) & UNARY MINUS(-) UNARY (–) MINUS – used to represent –ive values. ex.:- -5,-50,-3.14 etc. UNARY (+) PLUS – used to represent +ive values. ex.:- +5,+50,+3.14 etc. In C++ by default values are considered as +ive so no need to explicitly use UNARY (+)PLUS. AAKASH KAUSHIK 9891983083,9289817971
  • 7. INCREMENT/DECREMENT OPERATOR Increment operator increases integer value by one. For ex.:- int a=10; a++; //will give 11 Decrement operator decreases integer value by one. For ex.:- int a=10; a--; //will give 9 AAKASH KAUSHIK 9891983083,9289817971
  • 8. BINARY OPERATORS The Binary operator takes 2 arguments.
  • 9. TYPE OF BINARY OPERATORS ARITHMETIC OPERATORS RELATIONAL OPERATORS LOGICAL OPERATORS AAKASH KAUSHIK 9891983083,9289817971
  • 10. ARITHMETIC OPERATORS Arithmetic operators are used for mathematic calculations. AAKASH KAUSHIK 9891983083,9289817971
  • 11. RELATIONAL OPERATORS A relational operator compares two operands to determine whether one is greater than, greater than or equal to, less than, less than or equal to the other. If the condition is true, it will return non-zero value, if the condition is false, it will return 0. AAKASH KAUSHIK 9891983083,9289817971
  • 12. RELATIONAL OPERATORS AAKASH KAUSHIK 9891983083,9289817971
  • 13. LOGICAL OPERATORS(AND,OR,NOT) Logical operators are used in situation when we have more then one condition in a single statement. The logical operators && and || are used when evaluating two expressions to obtain a single relational result. The logical operator ! Is used for negation purpose. Basically, it returns the opposite Boolean value of evaluating its operand. AAKASH KAUSHIK 9891983083,9289817971
  • 14. LOGICAL OPERATORS AAKASH KAUSHIK 9891983083,9289817971
  • 15. TERNARY OPERATORS THE ONE AND ONLY TERNARY OPERATOR IS CONDTIONAL OPERATOR( ? : )
  • 16. CONDITIONAL OPERATOR The conditional operator is also known as ternary operator. It is called ternary operator because it takes three arguments. First is condition, second and third is value. The conditional operator check the condition, if condition is true, it will return second value, if condition is false, it will return third value. Syntax:- val = condition ? val1 : val2; AAKASH KAUSHIK 9891983083,9289817971
  • 17. TERNARY OPERATOR USAGE EXAMPLE #include<iostream.h> #include<conio.h> void main() { clrscr(); int x=5,y=2,lrg; lrg = (x>y) ? x : y; cout<<"nlargest number is : "<<lrg; getch(); } Output : Largest number is : 5 AAKASH KAUSHIK 9891983083,9289817971
  • 18. SOME MORE SPECIAL OPERATORS SIZEOF & COMMA OPERATOR
  • 19. SIZEOF OPERATOR The sizeof is a compile time operator, and used with an operand, it returns the number of bytes the operand occupies. The operand may be a variable, a constant or a data type qualifier. m=sizeof(sum); n=sizeof(long int); k=sizeof(235L); AAKASH KAUSHIK 9891983083,9289817971
  • 20. COMMA OPERATOR(,) The comma operator (,) is used to separate two or more expressions that are included where only one expression is expected. When the set of expressions has to be evaluated for a value, only the right-most expression is considered. For example, the following code: a = (b=3, b+2); would first assign the value 3 to b, and then assign b+2 to variable a. So, at the end, variable a would contain the value 5 while variable b would contain AAKASH KAUSHIK value 3. 9891983083,9289817971
  • 21. THANK YOU AAKASH KAUSHIK 9891983083,9289817971