Adobe Scan 18 Dec 2024
Adobe Scan 18 Dec 2024
" Rangoli making -college's front region floor planned for Rangoli
" poster arrangements( for competitionsrOom no 3)
" Mathematical model arrangementroom no 3
" Poster on projects Visible front campus of college.
At 1.00 pm
&&& & *,
1,% (rype) Sizeof * -,+
!=
, &
Operator(s)
OR
Logical|Logical
AND wiseOR AND
Bit XORwiseinequality
Bit Equality ShiftAddiionand Pointer|Pointer
Multiplication,
wiseBit and than, Less subtraction
(remainder). (coercion)
Typecast Sizeaddress
PointerLogincrement
cdecrement member
Class
al aUnarnd yreference elconstruction
Arement
Pointerreference
ray ValFunct
ue ionGlcaol(balsucnaropey)
greater than, left of Description(s)
to to an minus to
less and membermember negat
dereference
object ion class
than and
than shift division
or right selector
selector and plus nember
equal or (indirection) l's
equal,
and
modulus complement reference
greater
and
Associativity
leftto
lefttoright
right
left right
to leftto
right right
left
leftto right to
right
lefttoright lefttoright
lefttorightlefttoright lefttoright leftto right
lefttoright
leftto right lefttoright
lefttoright
leftto right lefttorightlefttorightleftto rightlefttorightlefttorighilefttozightleftto
sameleve Introductior
Connect
expressi AritH1)Some ofBrackets
Min C++ In
sc 2)
In +5,
b.
Mind C++ In 2) connected same
expression 1) Some Brackets IntroductionC++ to
some
Increment C. b. a.
Arithmetic
provides
it, of level. +=,
Ternary
Needs e.g. Here e.g. This % * operands.
-
Following+ Needs 2
Binary e.gNeeds
. Unary o=,*=,=,
situations,conditional
these (Subtraction
(Slash /(Addition
(Multiplication the are >>=,
K<= =,
(Modulus ta, by is Level
5operator
it a+ arithmetic
only made important evaluated &=,
special
operators and 3 gives
% b, or arithmetic arithmetic
-b operators:
operands.
arithmetic 2 c/d, division) uses evaluate ^=,
decrement a operator arithmetic
or one up
operators need remainder separators
can' t or
plus) of _expression
from Comma |AssignmentConditional
wil a unary
operand. operators
are give % minus)
or operators.
operator
may This be operator from
the
constants, They
unary b, star) separators operator
lateroperator applied
operators
++arise is l etc.
after for leftinside
as are
i.e. and inone Following to
to division.a remainder) varjables,.a used right out,
warning increase
this ofremainder with need
namely+
--
chapter). the for when
to floats 2
special are
do operands. (positive) mathematical dealing
on or
the while or the
combination
a double subtypes:
singledecrease,
same. features
5/2 with
will type. and
operand. multiple
value of - calçulations. of
C++ give (negative). both right
leftto rightleftto
rightleftto
of 2
a
language. or operators
as
variable a
quotient. function a An
(See
arithmetic of
by the 43
1. call,
Introduction to Ct
floating-point data type.
constant or
44 decrement types:variable and then take this new
increment or be of2
can
Alsoit is illegal to decrementing the yalue of the
and
increment/decrement
Theincrementing decrement the
a. Prefix:
first
value for processing.
e.g. ++a,--b
variable
increment or variable.
Eg
take the value ofthe
b. Postfix: First
a++, b respectively.
and Postfix 5 them. Here values of a
Use ofPrefix b are 5 and b-and print and
ofa and and
Supposeinitial values operation on it i.e. a++
postfix them wil be
bUPpose, I do
b remain
only.
unaltered. i.e. 5 and 5 done,values of a and b are printed
changed
operation is
While after postfix
to 6 and 4 respectively.
operators are binary
3) Relational operator: between 2 values. All C++
the relation
These are used to test
operators and hence require 2 operands. arithmetic expressions connected by a relationai
is made up of 2 nonzero when it is true.
Arelational expression when the relation is false while
operator. Itreturns zero
Result
Symbol Form
Operator a<b Returns 1 if ais iess thanb
Less than otherwise 0
After testing the conditions, they return logical status (true or false)
may be constants, variables or
They may be unary or binary operators, and the operands
numbers.
even expressions. The operands may be integers/floating point
Form Result
Operator Symbol
a& & b Returns lif a and b are nonzero
Logical AND & &
else returns )
a ll b Returns 1if a or b is nonzero,
Logical OR
else 0
!a Returns 1if a is zero else
Logical negation returns 0
6) Assignment operator ( =)
=operator causes the value of the right hand operand to be
operand. assigned to the left hau
The left hand operand, sometimes called as
location. lvalue, must always refer toa memoy
8) Bitwise operators:
Some special C+t oprators can also work on the bits, so they may be called to as bit
al manipulation operators.
They are used to manipulate or modify the individual bits of the piece of data.
They can be used only with the integral built-in data type i.e. in connection with char or
Xt int.
1100 0111
e.g.
&
10110100
Result 1000 0100
e) Bitwise OR operator ( |)
It also works on 2operands. It is used to set the resultant bit to 1.
1 bit 2nd bit 1 bit 2nd bit
- 1
1
1001 1101
Result 1101 1101
Introduction to C++
49
1
1 1
0
1100 1001
0111 0001
54
conversions)
Implicit Conversions (automatic
We can mix data types in expressions
C++
e.g m =5 +2.75
are
is a valid statement. Wherever data types known
mixed
as
in an expression,
implicit or
automatic performs
conversions,
the
conversions automatically. This processis it divides the expressions into sub-
When the compiler encounters an expression, operands. For a binary
one or two
expressions consisting of one operator andconverts withoperator, if
using the rule that the "smaller" type is convertedtoone
the operands type differs, the compiler
of them to match
the
the"wider" type. For example i one other,
converted into a float
of the operand is an int and the other is a float the int
is
of different types are mixed in an
because a
loat is wider than an int. This happens when values
expression.
e.g. double d = 1; I/d receives 1.0
int i= 10.5; /ireceives 10
i=i+d; l/ means:i= int(double(i) + d)
In the last éxample, i + d involves mismatching types, so i is first converted to double
(promoted) and then added to d.The result is a double,which does not match the type of i
on the left side of the assignment, so it is converted to int (demoted) before being
assigned to i.
14) stream manipulation operators
For formatting the data display, manipulator operators are used. Normally used with (<<)
operator to modify or manipulate the way the data is displayed. These are present in
<iomanip.h>header file.
Some of the useful stream manipulators are:-
Here endl is a stream manipulator, causing a linefeed to be inserted into stream. Thus
values of a and b are displayed on 2different lines.
IS lhe 3.6 COMMENTS in C++
Comments are important part of any program even though they are not mandatory to be
iven, Normally they are used to make program readable. The compiler
Suh. ments. so they do not add to the file size or execution time ignores
Orher,i, They can be specified in C++ using or /* */
the text to be commented */ is a single line comment.,
of executable program.
one
Se a
while // is used as a multiline comment.
e.g. #include<iostream.h>
an void main()
int a=10;
I/Following declaration willdisplay value of a on screen
cout<<a='<ka;
f; So in this program the text "Following declaration will display value of a on screen"
won't be compiled, so it will not be displayed on the screen.
Comments are useful to make program readable, if programming code is large enough.
3.7 SCOPE and VISIBILITY
The scope or visibility ofa variable determnines whether it can be accessed from other
functions in the same source file or in other source files. The position of an identifier
within a block is also a factor in determining scope. In others words it is that part of a
program over which the identifier can be seen by other identifiers and used by other
identifiers.
External variables, defined outside any block and memory for these is allocated once.
Even though the external variable is declared more than once, it only has
memory
allocated to it once. Variables can be declared as global variables, available to everything,
these are also known as external variables. External variables are defined outside of any
functions and retain their valuesduring the course of a program.
Static variables are variables that are local to a function but which (unlike auto
Variables) retain their values between invocations of the function - these are internal static
Variables. The second kind of static are external- or global variables that are local to a file
Dut not a part of any function. The main use of these is to bhide the variable so that other
SOUrCe code files don't see the variable. Static storage comes from a different memory
alocation it.is allocated from a static area of memory so static variables within
56 Introduction to
functions can retain their values between calls to the functions. Static variables can be
the first call.
amazed to some value other than 0 but will only beinitialized at
Automatic variable inside function doesn't exist until the function is called. At
time the memory for the automatic variable is allocated dynamically from a tha
stack and released when the function is finished. Auto variables are not initialized at memorstarty
up but each time they are called and do not retain their Values.