This document provides an overview of different types of operators in the C programming language. It discusses arithmetic, relational, logical, bitwise, assignment, conditional, and increment/decrement operators. For each type of operator, it provides examples of common operators of that type, along with brief descriptions of what they do. The document also includes truth tables for bitwise operators and discusses the syntax and usage of conditional and increment/decrement operators.
The document discusses various operators in C# programming including unary, binary, and ternary operators. It explains operators such as increment, decrement, bitwise inversion, logical, assignment, comparison, arithmetic, and more. Examples are provided to demonstrate how each operator works. The document also covers operator precedence and escape sequences.
The document discusses various operators in C# programming including unary, binary, and ternary operators. It explains operators such as increment, comparison, bitwise, logical, assignment, and escape sequence operators. It also covers Math class methods for common mathematical operations.
The document discusses various C# operators including unary operators, binary operators, and ternary operators. It provides examples and explanations of increment/decrement, bitwise, logical, comparison, and assignment operators. It also covers operator precedence and uses the Math class for common mathematical functions.
The document discusses various fundamental concepts in C programming language such as character set, tokens, identifiers, keywords, data types, variables, constants, expressions, operators, precedence and associativity of operators. It provides details about each concept with examples. It explains that characters, digits and symbols make up the character set in C. It also describes the different types of tokens, identifiers, keywords, basic and derived data types and their sizes. Furthermore, it covers the naming rules for variables and different types of constants. The document elaborates on expressions, various types of operators like arithmetic, relational, logical etc. along with their precedence and associativity rules.
The document discusses various fundamental concepts in C programming language such as character set, tokens, identifiers, keywords, data types, variables, constants, expressions, operators, precedence and associativity of operators. It provides details about each concept with examples. The character set in C includes uppercase letters, lowercase letters, digits and special symbols. Tokens are the smallest individual elements like keywords, identifiers, constants, variables etc. that the compiler recognizes. Identifiers are used to name variables, functions etc. while keywords are reserved words that cannot be used as identifiers. The document also explains different data types in C, how variables are declared and named, types of constants and expressions. It provides detailed information about various operators supported in C like arithmetic,
The document discusses various operators in Python including arithmetic, comparison, bitwise, logical, and membership operators. It provides examples of using each operator and explains their functionality. The key types of operators covered are arithmetic (e.g. +, -, *, /), comparison (e.g. ==, !=, >, <), bitwise (e.g. &, |, ^), logical (e.g. and, or, not), and membership (e.g. in, not in) operators. It also discusses operator precedence and provides examples of expressions using different operators.
Operators in C and C++ Programming Language:
Operators are the symbols which tells the language compiler to perform a specific mathematical or logical function. C and C++ programming is very rich in Operators. C and C++ Language Provides the following type of Operator:-
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment Operators
6. Misc Operators
You will Study all these operators with these Slides. Hope you will find it helpful. If you find it helpful then please Let others know by Like and Sharing. If you don't like so please let us know. So that i can make it more better.
If you have to ask anything about any operator then you can ask in comments.
Thankyou for visit
Sahyog Vishwakarma
The document discusses various operators in C# including arithmetic, logical, bitwise, comparison, and assignment operators. It provides examples of using each operator type and discusses operator precedence. Key points covered include the different categories of operators in C#, how they work, precedence rules, and examples of using each type of operator to perform calculations and comparisons in C# code.
data type.pptxddddswwyertr hai na ki extend kr de laLEOFAKE
C language supports various operators to manipulate data and variables. These include arithmetic, relational, logical, bitwise, assignment, conditional, and special operators. Operators perform mathematical and logical operations on operands. For example, arithmetic operators like +, -, *, / perform addition, subtraction, multiplication, and division respectively. Relational operators like ==, !=, >, <, >=, <= are used to compare operands. Logical operators like &&, ||, ! are used in conditional statements. Assignment operators like =, +=, -=, *=, /= assign values. The conditional operator ?: acts like an inline if-else statement. Data types specify the type of data variables can hold, and include primary types like int
This document provides an introduction to Python fundamentals, including its basic elements and syntax. It discusses the key components needed to write Python programs, such as variables, identifiers, keywords, datatypes, input/output, comments, constants, and operators. Variables are used to store data values, identifiers name variables, and keywords are reserved words that cannot be used as identifiers. There are built-in datatypes like integers, floats, Booleans and strings. The document also covers basic operators for manipulating data and performing comparisons.
C operators allow building expressions and making decisions in code. The document discusses several categories of operators in C including arithmetic, assignment, relational, logical, bitwise, and others. It provides examples of using each type of operator and explains precedence rules and associativity. Key points covered include: how each operator works; common uses like conditional checks, assignments, and bit manipulation; and important considerations like order of operations and integer division behavior.
C operators allow building expressions and performing operations in C programs. The main types of operators in C are arithmetic, assignment, logical/relational, bitwise, and others like sizeof. Arithmetic operators perform math operations like addition and subtraction. Assignment operators assign values. Logical operators allow conditional logic. Relational operators compare values. Bitwise operators work at the bit level. Precedence rules determine the order calculations are performed. Operators are used with operands and follow consistent rules in C.
This document discusses operators in C# programming. It defines operators as symbols that tell the compiler to perform mathematical or logical manipulations. The document then covers various types of operators in C#, including arithmetic, relational, logical, bitwise, and assignment operators. It provides examples of each operator and explains their functionality and usage.
The document discusses the basics of C++ programming including:
- Source code is written in a high-level language and saved with file extensions like .cpp.
- The compiler converts source code into machine-readable object code. It checks for syntax errors and translates the program.
- The linker combines object code with library files to create an executable file with a .exe extension that can be run by the operating system.
Python tutorials for beginners | IQ Online TrainingRahul Tandale
Python training program walks you through basics of python language and gives you in-depth knowledge of function,collections,REs,Exception Handing,
Socket programming and OOP basics.The course also explains object-oriented as well as functional programming techniques,error handling,packaging system and network programming.The course curriculum is designed for developer,system administrators and QA engineers.
This program also covers many of python extensions(libraries)as well as best practices
This document discusses operators in the C programming language. It defines operators as program elements that are applied to operands in expressions or statements. The main types of operators covered are arithmetic, relational, equality, logical, bitwise, assignment, and conditional operators. For each type of operator, the document provides examples of their usage and precedence rules for evaluating expressions containing multiple operators.
An operator is a symbol that tells the computer to perform certain mathematical or logical manipulation on data stored in variables. The variables that are operated are termed as operands.
C operators can be classified into a number of categories. They include:
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Assignment operator
5. Increment and decrement operators
6. Conditional operator
7. Bitwise operators
8. Special operators
Now, let us discuss each category in detail.
Operators are symbols that tell the compiler to perform mathematical or logical manipulations on operands. This document discusses the different types of operators in C language, including arithmetic, relational, logical, assignment, increment/decrement, conditional, and bitwise operators. It also covers operator precedence and type conversions.
The document discusses various types of operators in C programming language. It describes arithmetic, conditional, bitwise, relational and logical operators. For arithmetic operators, it explains integer, real and mixed-mode arithmetic. For bitwise operators, it provides details about logical operators like AND, OR and XOR as well as shift operators. It also discusses one's complement operation. The document serves as a report submitted to provide information about different categories of operators supported in C language.
Operators are symbols that perform specific tasks like mathematical or logical operations on operands or values. There are several types of operators in C/C++ including arithmetic, relational, logical, bitwise, assignment, conditional, and special operators. Arithmetic operators perform math operations like addition, subtraction, multiplication, and division. Relational operators check relationships between operands like equality, greater than, less than. Logical operators perform logical AND, OR, and NOT operations.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
C++ provides operators for composing arithmetic, relational, logical, bitwise, and conditional expressions. It also provides operators which produce useful side-effects, such as assignment, increment, and decrement. We will look at each category of operators in turn. We will also discuss the precedence rules which govern the order of operator evaluation in a multi-operator expression.
The document discusses operators in C# for performing calculations. It covers arithmetic, logical, comparison, assignment, and other operators. It explains operator precedence and describes implicit and explicit type conversions. Expressions are defined as sequences of operators and operands that are evaluated to a single value. Examples are provided to demonstrate the use of various operators and expressions to perform calculations in C#.
Operators in C and C++ Programming Language:
Operators are the symbols which tells the language compiler to perform a specific mathematical or logical function. C and C++ programming is very rich in Operators. C and C++ Language Provides the following type of Operator:-
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment Operators
6. Misc Operators
You will Study all these operators with these Slides. Hope you will find it helpful. If you find it helpful then please Let others know by Like and Sharing. If you don't like so please let us know. So that i can make it more better.
If you have to ask anything about any operator then you can ask in comments.
Thankyou for visit
Sahyog Vishwakarma
The document discusses various operators in C# including arithmetic, logical, bitwise, comparison, and assignment operators. It provides examples of using each operator type and discusses operator precedence. Key points covered include the different categories of operators in C#, how they work, precedence rules, and examples of using each type of operator to perform calculations and comparisons in C# code.
data type.pptxddddswwyertr hai na ki extend kr de laLEOFAKE
C language supports various operators to manipulate data and variables. These include arithmetic, relational, logical, bitwise, assignment, conditional, and special operators. Operators perform mathematical and logical operations on operands. For example, arithmetic operators like +, -, *, / perform addition, subtraction, multiplication, and division respectively. Relational operators like ==, !=, >, <, >=, <= are used to compare operands. Logical operators like &&, ||, ! are used in conditional statements. Assignment operators like =, +=, -=, *=, /= assign values. The conditional operator ?: acts like an inline if-else statement. Data types specify the type of data variables can hold, and include primary types like int
This document provides an introduction to Python fundamentals, including its basic elements and syntax. It discusses the key components needed to write Python programs, such as variables, identifiers, keywords, datatypes, input/output, comments, constants, and operators. Variables are used to store data values, identifiers name variables, and keywords are reserved words that cannot be used as identifiers. There are built-in datatypes like integers, floats, Booleans and strings. The document also covers basic operators for manipulating data and performing comparisons.
C operators allow building expressions and making decisions in code. The document discusses several categories of operators in C including arithmetic, assignment, relational, logical, bitwise, and others. It provides examples of using each type of operator and explains precedence rules and associativity. Key points covered include: how each operator works; common uses like conditional checks, assignments, and bit manipulation; and important considerations like order of operations and integer division behavior.
C operators allow building expressions and performing operations in C programs. The main types of operators in C are arithmetic, assignment, logical/relational, bitwise, and others like sizeof. Arithmetic operators perform math operations like addition and subtraction. Assignment operators assign values. Logical operators allow conditional logic. Relational operators compare values. Bitwise operators work at the bit level. Precedence rules determine the order calculations are performed. Operators are used with operands and follow consistent rules in C.
This document discusses operators in C# programming. It defines operators as symbols that tell the compiler to perform mathematical or logical manipulations. The document then covers various types of operators in C#, including arithmetic, relational, logical, bitwise, and assignment operators. It provides examples of each operator and explains their functionality and usage.
The document discusses the basics of C++ programming including:
- Source code is written in a high-level language and saved with file extensions like .cpp.
- The compiler converts source code into machine-readable object code. It checks for syntax errors and translates the program.
- The linker combines object code with library files to create an executable file with a .exe extension that can be run by the operating system.
Python tutorials for beginners | IQ Online TrainingRahul Tandale
Python training program walks you through basics of python language and gives you in-depth knowledge of function,collections,REs,Exception Handing,
Socket programming and OOP basics.The course also explains object-oriented as well as functional programming techniques,error handling,packaging system and network programming.The course curriculum is designed for developer,system administrators and QA engineers.
This program also covers many of python extensions(libraries)as well as best practices
This document discusses operators in the C programming language. It defines operators as program elements that are applied to operands in expressions or statements. The main types of operators covered are arithmetic, relational, equality, logical, bitwise, assignment, and conditional operators. For each type of operator, the document provides examples of their usage and precedence rules for evaluating expressions containing multiple operators.
An operator is a symbol that tells the computer to perform certain mathematical or logical manipulation on data stored in variables. The variables that are operated are termed as operands.
C operators can be classified into a number of categories. They include:
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Assignment operator
5. Increment and decrement operators
6. Conditional operator
7. Bitwise operators
8. Special operators
Now, let us discuss each category in detail.
Operators are symbols that tell the compiler to perform mathematical or logical manipulations on operands. This document discusses the different types of operators in C language, including arithmetic, relational, logical, assignment, increment/decrement, conditional, and bitwise operators. It also covers operator precedence and type conversions.
The document discusses various types of operators in C programming language. It describes arithmetic, conditional, bitwise, relational and logical operators. For arithmetic operators, it explains integer, real and mixed-mode arithmetic. For bitwise operators, it provides details about logical operators like AND, OR and XOR as well as shift operators. It also discusses one's complement operation. The document serves as a report submitted to provide information about different categories of operators supported in C language.
Operators are symbols that perform specific tasks like mathematical or logical operations on operands or values. There are several types of operators in C/C++ including arithmetic, relational, logical, bitwise, assignment, conditional, and special operators. Arithmetic operators perform math operations like addition, subtraction, multiplication, and division. Relational operators check relationships between operands like equality, greater than, less than. Logical operators perform logical AND, OR, and NOT operations.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
C++ provides operators for composing arithmetic, relational, logical, bitwise, and conditional expressions. It also provides operators which produce useful side-effects, such as assignment, increment, and decrement. We will look at each category of operators in turn. We will also discuss the precedence rules which govern the order of operator evaluation in a multi-operator expression.
The document discusses operators in C# for performing calculations. It covers arithmetic, logical, comparison, assignment, and other operators. It explains operator precedence and describes implicit and explicit type conversions. Expressions are defined as sequences of operators and operands that are evaluated to a single value. Examples are provided to demonstrate the use of various operators and expressions to perform calculations in C#.
Geography Sem II Unit 1C Correlation of Geography with other school subjectsProfDrShaikhImran
The correlation of school subjects refers to the interconnectedness and mutual reinforcement between different academic disciplines. This concept highlights how knowledge and skills in one subject can support, enhance, or overlap with learning in another. Recognizing these correlations helps in creating a more holistic and meaningful educational experience.
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schoolsdogden2
Algebra 1 is often described as a “gateway” class, a pivotal moment that can shape the rest of a student’s K–12 education. Early access is key: successfully completing Algebra 1 in middle school allows students to complete advanced math and science coursework in high school, which research shows lead to higher wages and lower rates of unemployment in adulthood.
Learn how The Atlanta Public Schools is using their data to create a more equitable enrollment in middle school Algebra classes.
Exploring Substances:
Acidic, Basic, and
Neutral
Welcome to the fascinating world of acids and bases! Join siblings Ashwin and
Keerthi as they explore the colorful world of substances at their school's
National Science Day fair. Their adventure begins with a mysterious white paper
that reveals hidden messages when sprayed with a special liquid.
In this presentation, we'll discover how different substances can be classified as
acidic, basic, or neutral. We'll explore natural indicators like litmus, red rose
extract, and turmeric that help us identify these substances through color
changes. We'll also learn about neutralization reactions and their applications in
our daily lives.
by sandeep swamy
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...Celine George
Analytic accounts are used to track and manage financial transactions related to specific projects, departments, or business units. They provide detailed insights into costs and revenues at a granular level, independent of the main accounting system. This helps to better understand profitability, performance, and resource allocation, making it easier to make informed financial decisions and strategic planning.
INTRO TO STATISTICS
INTRO TO SPSS INTERFACE
CLEANING MULTIPLE CHOICE RESPONSE DATA WITH EXCEL
ANALYZING MULTIPLE CHOICE RESPONSE DATA
INTERPRETATION
Q & A SESSION
PRACTICAL HANDS-ON ACTIVITY
The *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responThe *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responses*: Insects can exhibit complex behaviors, such as mating, foraging, and social interactions.
Characteristics
1. *Decentralized*: Insect nervous systems have some autonomy in different body parts.
2. *Specialized*: Different parts of the nervous system are specialized for specific functions.
3. *Efficient*: Insect nervous systems are highly efficient, allowing for rapid processing and response to stimuli.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive in diverse environments.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive
The Pala kings were people-protectors. In fact, Gopal was elected to the throne only to end Matsya Nyaya. Bhagalpur Abhiledh states that Dharmapala imposed only fair taxes on the people. Rampala abolished the unjust taxes imposed by Bhima. The Pala rulers were lovers of learning. Vikramshila University was established by Dharmapala. He opened 50 other learning centers. A famous Buddhist scholar named Haribhadra was to be present in his court. Devpala appointed another Buddhist scholar named Veerdeva as the vice president of Nalanda Vihar. Among other scholars of this period, Sandhyakar Nandi, Chakrapani Dutta and Vajradatta are especially famous. Sandhyakar Nandi wrote the famous poem of this period 'Ramcharit'.
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsesushreesangita003
what is pulse ?
Purpose
physiology and Regulation of pulse
Characteristics of pulse
factors affecting pulse
Sites of pulse
Alteration of pulse
for BSC Nursing 1st semester
for Gnm Nursing 1st year
Students .
vitalsign
How to manage Multiple Warehouses for multiple floors in odoo point of saleCeline George
The need for multiple warehouses and effective inventory management is crucial for companies aiming to optimize their operations, enhance customer satisfaction, and maintain a competitive edge.
As of Mid to April Ending, I am building a new Reiki-Yoga Series. No worries, they are free workshops. So far, I have 3 presentations so its a gradual process. If interested visit: https://www.slideshare.net/YogaPrincess
https://ldmchapels.weebly.com
Blessings and Happy Spring. We are hitting Mid Season.
6. 6
Compiler VS Interpreter
Compiler
● Scans whole program at
one go
● Errors are shown at the
end
● Compilation is slow
● Execution is fast
● Generates an intermediate
code
● C,C++
Interpreter
● Translate one statement
at a time(line by line)
● Errors are shown line by
line
● Translation is done fast
● Execution is slow
● Execute the program
without intermediate code
● Python,Javascript
7. 7
To Run C/C++ program we need :
C/C++ Compiler and VS code setup
● Text Editor (VS code)
● C++ compiler (GCC compiler)
● C/C++ - VS code extension
● Code Runner - VS code extension
Extra Setup:
13. 13
Rules for naming a variable
● Variable names in C++ can range from 1 to 255
characters.
● All variable names must begin with a letter of the
alphabet or an underscore(_).
● After the first initial letter, variable names can also
contain letters and numbers.
● Variable names are case sensitive.
● No spaces or special characters are allowed.
● You cannot use a C++ keyword (a reserved word)
as a variable name.
16. 16
Data Type Size Value Range
int 4 Bytes -2147483648 to 2147483647
char 1 Bytes -127 to 127 or 0 to 255
float 4 Bytes - 3.4E38 to 3.4E38
double 8 Byte - 1.7E308 to 1.7E + 308
bool 1 Byte
18. 18
Data Type Size Value Range
int 4 Bytes -2147483648 to 2147483647
Unsigned int 4 Bytes 0 to 4294967295
signed int 4 Bytes -2147483648 to 2147483647
Sort int 2 Bytes -32768 to 32767
long int 8 Bytes -2,147,483,648 to 2,147,483,647
char 1 Bytes -127 to 127 or 0 to 255
Unsigned char 1 Bytes 0 to 255
Signed char 1 Byte -127 to 127
float 4 Bytes - 3.4E38 to 3.4E38
double 8 Byte - 1.7E308 to 1.7E + 308
long double 12 Bytes - 3.4E4932 to 1.1E + 4932
bool 1 Byte
20. Constant Variables
● A const variable must be assigned a value at the
time of its declaration.
● If we declare a variable as const, we cannot
change its value.
● Once initialized, if we try to change its value, then
we will get compilation error.
20
21. Manipulators in c++
21
Manipulator Purpose Header File
endl causes line feed to be inserted i.e. ‘n’ iostream.h
dec,oct,hex set the desired number system iostream.h
setbase (b) output integers in base b iomanip.h
setw(w) read or write values to w characters iomanip.h
setfill (c) fills the whitespace with character c iomanip.h
setprecision(n) set floating point precision to n iomanip.h
22. Operators in C++
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Assignment Operators
5. Bitwise Operators
6. Other Operators
22
24. 24
Arithmetic Operators
Operator Description Example
+ Adds two operands A+B=30
- Subtracts second operand from the first A-B=10
* Multiplies both operands A*B=200
/ Divides numerator by de-numerator A/B=2
% Modulus operator – the result is the remainder of the
division
A%B=0
++ Increment operator, increases integer value by one A++ will give 21
-- Decrement operator, decreases integer value by one B-- will give 9
Assume A=20 and B=10
25. 25
Relational Operators
Operator Description Example
== Checks if the values of two operands are equal or not. (A == B) = false
!= Checks if the values of two operands are equal or not. (A != B) = true
> Checks if the value of left operand is greater than the value of
right operand
(A>B) = true
< Checks if the value of left operand is less than the value of right
operand,
(A<B) = false
>= Checks if the value of left operand is greater than or equal to
the value of right operand
(A>=B) = true
<= Checks if the value of left operand is less than or equal to the
value of right operand
(A<=B) = false
Assume A=20 and B=10
26. 26
Logical Operators
Operator Description Example
&& Logical AND. True only if all the operands are true. (A>10 && B>20) = false
|| Logical OR. True if at least one of the operands is true. (A>10 || B>20) = true
! Called Logical NOT Operator. Use to reverses the
logical state of its operand. If a condition is true, then
Logical NOT operator will make false.
!(A>10) = false
Assume A=20 and B=10
27. 27
Logical Operators
A B A && B A|| B !A
false false false false true
false true false true true
true false false true false
true true true true false
28. 28
Assignment Operators
Operator Description Example
= Assigns values from right side operands to left side
operand.
A =5
+= It adds right operand to the left operand and assign the
result to left operand
A +=5 same as A=A+5
-= It subtracts right operand from the left operand and
assign the result to left operand.
A-=5 same as A=A-5
*= It multiplies right operand with the left operand and
assign the result to left operand.
A*=5 same as A=A*5
/= It divides left operand with the right operand and assign
the result to left operand.
A/=5 same as A=A/5
%= It takes modulus using two operands and assign the
result to left operand.
A%=5 same as A=A%5
30. 30
Bitwise Operators
Operator Description Example
& Binary AND Operator copies a bit to the result if it exists in
both operands.
(A & B) = 1 (00000001)
| Binary OR Operator copies a bit if it exists in either operand. (A | B) = 3 (00000011)
^ Binary XOR Operator copies the bit if it is set in one operand
but not both.
(A ^ B) = 2 (00000010)
~ Binary Ones Complement Operator is unary and has the
effect of 'flipping' bits.
!A=!3= -4 (11111100)
<< Binary Left Shift Operator. The left operands value is moved left
by the number of bits specified by the right operand.
A<<1 = 6 (00000110)
>> Binary Right Shift Operator. The left operands value is moved right by
the number of bits specified by the right operand.
A>>1 = 1 (00000001)
A=3 (0000 0011 ) and B=1 (0000 0001)
31. 31
Other Operators
Operator Description Example
sizeof Returns the size of variable sizeof(int) =4
Condition ? x:y If condition is true then it returns value of X
otherwise returns value of Y
Int y=20;
int x= (y < 10) ? 30 : 40;
cast Convert one data type to other int(2.2000) = 2
,
causes a sequence of operations to be
performed. The value of the entire comma
expression is the value of the last expression
of the comma-separated list.
Int j=1;
int i= (j++, j+10, j+20);
& Returns the address of a variable
* Is pointer to a variable
32. 32
Operators Precedence and Associativity
Category Operator Associativity
Postfix () [] -> . ++ - - Left to right
Unary + - ! ~ ++ - - (type)* & sizeof Left to right
Multiplicative * / % Left to right
Additive + - Left to right
Shift << >> Left to right
Relational < <= > >= Left to right
Equality == != Left to right
Bitwise AND & Left to right
33. 33
Operators Precedence and Associativity
Category Operator Associativity
Bitwise XOR ^ Left to right
Bitwise OR | Left to right
Logical AND && Left to right
Logical OR || Left to right
Conditional ?: Right to left
Assignment = += -= *= /= %=>>= <<= &= ^= |= Right to left
Comma , Left to right
34. Increment (++) and decrement (--)
34
1. The increment operator ++ increases the value of a variable
by 1
2. Similarly, the decrement operator -- decreases the value of a
variable by 1
3. Increment and decrement operators can be used only with
variables. They can't be used with constants or
expressions.
Eg. x=5,y=6;
x++; // valid
5++; // invalid
(x+y)++; // invalid
35. Types of Increment ++ operator
35
Increment ++
Post-increment
Eg. a++
Pre-increment
Eg. ++a
1. In pre-increment first increment the value of variable and then
used inside the expression (initialize into another variable).
2. In post-increment first value of variable is use in the expression
(initialize into another variable) and then increment the value of
variable.
36. Types of decrement -- operator
36
decrement --
Post-decrement
Eg. a--
Pre-decrement
Eg. --a
1. In pre-decrement first decrement the value of variable and then
used inside the expression (initialize into another variable).
2. In post-decrement first value of variable is use in the expression
(initialize into another variable) and then decrement the value of
variable.
37. 37
● If-else
● Switch
● For Loop
● While loop
● Do-While Loop
● Break /Continue
● Goto
Control Statement
38. 38
● If statement
● If...else statement
● If…else if…else statement
● Nested if statement
If-else
39. 39
● Write a C++ program to accept two integers and check whether they are
equal or not.
● Write a C++ program to accept a integer and check whether number is
even or odd.
● Write a C++ program to accept a integer and check whether number is
positive,negative or zero.
● Write a program in C++ to read any day number in integer and display day
name in the word.
● Write a C++ program to accept two integers and find maximum between
two numbers.
If-else practice questions :
41. 41
Switch-case practice questions :
● Write a C++ program to print day of week name using switch case.
● Write a C++ program print total number of days in a month using switch
case.
● Write a C++ program to accept a integer and check whether number is
positive,negative or zero using switch case.
● Write a program in C++ to read any day number in integer and display day
name in the word using switch case.
43. 43
For loop :
Syntax :
for(initialization;condition;increment){
// your code
}
Example:
for(int i=0;i<5;i++){
cout<<i<<”n”;
}
44. 44
While loop :
Syntax :
while(condition){
// your code
}
Example:
int i=0;
while(i<10){
cout<<i<<”n”;
i++;
}
45. 45
do-while loop :
Syntax :
do{
// your code
}while(condition)
Example:
int i=0;
do{
cout<<i<<”n”;
i++;
}while(i<10)
46. 46
Loop practice questions :
● Write a program in C++ to find the first 10 natural numbers
○ 1 2 3 4 5 6 7 8 9 10
● Write a program in C++ to print a square pattern with # character.
● Write a program in C++ to find the factorial of a number.
● Write a program in C++ to display the pattern like right angle triangle using
an asterisk.
47. 47
Loop practice questions :
● Write a program in C++ to display the pattern like right angle triangle using
an asterisk.
● Write a program in C++ to make such a pattern like a pyramid with an
asterisk.
48. 48
Break
● In C++, the break statement terminates the loop when it is encountered.
49. 49
Continue
● In C++, the continue is used to skip the current iteration of the loop and the
control of the program goes to the next iteration
51. C++ Functions
51
● A function is a block of code that performs a specific task.
● Functions help us in reducing code redundancy.
● If functionality is performed at multiple places in software,
then rather than writing the same code, again and again, we
create a function and call it everywhere.
● This also helps in maintenance as we have to change at one
place if we make future changes to the functionality.
52. C++ Functions
52
● There are two types of function:
○ Library Functions (Built in functions)
○ User defined functions
● Function declaration
returnType functionName (parameter1, parameter2,...) {
// function body
}
53. Function Prototype
53
● The code of function declaration should be before the
function call.
● However, if we want to define a function after the function
call, we need to use the function prototype.
● Function prototype is a declaration statement.
type function-name (arguments-list);
Eg. int sum(int num1,int num2);
OR
int sum(int,int); // Variable name is optional
54. Default Parameters
54
● In C++, we can provide default values for function parameters.
● In this case, when we invoke the function, we don’t specify
parameters.
● Instead, the function takes the default parameters that are
provided in the prototype.
● Note that while providing default parameters, we always start from
the right-most parameter. Also, we cannot skip a parameter in
between and provide a default value for the next parameter.
● Eg.
Void add(int x, int y, int z = 0)
Default parameter
55. Const Parameters
55
● We can pass constant parameters to functions using the
‘const’ keyword.
● When a parameter or reference is const, it cannot be
changed inside the function.
Void add(const x, const y)
Const parameter
56. Inline Functions
56
● When we make a function call, internally it involves a compiler
storing the state of the program on a stack before passing
control to the function.
● When the function returns, the compiler has to retrieve the
program state back and continue from where it left.
● This poses an overhead. Hence, in C++ whenever we have a
function consisting of few statements, there is a facility that
allows it to expand inline.
● This is done by making a function inline. So inline functions are
the functions that are expanded at runtime, saving the efforts to
call the function and do the stack modifications.
57. Inline Functions
57
● But even if we make a function as inline, the compiler
does not guarantee that it will be expanded at runtime.
● In other words, it’s completely dependent on the compiler
to make the function inline or not.
● Eg.
inline int addition(const int a,const int b)