0% found this document useful (0 votes)
64 views45 pages

Introduction To Programming: Review

The document discusses bitwise manipulation and assignment operators. It covers bitwise AND, OR, and XOR assignment operators as well as regular assignment operators. It also discusses variables, data types, arrays, arithmetic operators, logical operators, comparison operators, if/else statements, loops (while, do-while, for), switch statements, functions, pointers, and file input/output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views45 pages

Introduction To Programming: Review

The document discusses bitwise manipulation and assignment operators. It covers bitwise AND, OR, and XOR assignment operators as well as regular assignment operators. It also discusses variables, data types, arrays, arithmetic operators, logical operators, comparison operators, if/else statements, loops (while, do-while, for), switch statements, functions, pointers, and file input/output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Introduction to Programming

Lecture 22
Review
Bit wise Manipulation
and
Assignment Operator
a =a+1;

a += 1 ;
Bit Manipulation Operators

&= Bitwise AND Assignment Operator


|= Bitwise OR Assignment Operator
^= Bitwise Exclusive OR Assignment
Operator
Assignment Operator

a &= b ;
Same as
a=a&b;
Assignment Operator

a |= b ;
Same as
a=a|b;
Assignment Operator

a ^= b ;
Same as
a=a^b;
Design Recipes
 Analyze a problem statement,
typically expressed as a word problem
 Express its essence, abstractly and
with examples
 Formulate statements and
comments in a precise language
 Evaluate and revise the activities in
the light of checks and tests.
 PAY ATTENTION TO DETAIL
Variables
Symbolic Names
x
i
BasicPay
HouseRent
Data types
 Whole numbers:
– int, short, long, unsigned
 Real Numbers (with decimal points)
– float, double
 Character data
– char
int = 4 bytes
char = 1 byte
ASCII Table
Arrays
Collection of same data types
Arithmetic Operators
Plus +
Minus -
Multiply *
Divide /
Modulus %
Modulus Operator

a%b;
7%2=1;
100 % 20 = 0 ;
Compound
Arithmetic Operators
+=
-=
*=
/=
%=
Compound
Arithmetic Operators

a=a+b;
a += b ;
Logical Operators

AND &&
OR ||
Comparison Operators
a<b;
a <= b ;
a == b ;
a >= b ;
a>b;
a = b;
if ( a = b )
//Wrong
//Logical Error
a>b;
a >= b ;
Bit wise Operators

Bit wise AND & (Binary)


Bit wise OR | (Binary)
Bit wise Exclusive OR ^ (Binary)
NOT ~ (unary)
 Sequential Construct
 Decision Construct
 Loop Construct
If-statement
if ( condition )
{
statement ( s ) ;
}
If-else
if ( condition )
{
statement ( s ) ;
}
else
{
statement ( s ) ;

}
if ( a > b && c < d )
Nested if
statements
if ( condition )
{
statement ( s ) ;

if ( condition )
{
statement ( s ) ;
}
statement ( s ) ;
}
While Loops
while ( a > b )
{
statement ( s ) ;
}
While Loops

While loop executes


zero or more times
Do - while
do
{
statement ( s ) ;
}
while ( condition ) ;
Do - while
Do-while loop
executes
one or more
times
For Loops
for ( i = 0 ; i < 10 ; i ++ ; )
{
statement ( s ) ;
}
 i=i+1;
 i += 1 ;

 i ++ ;
Switch Statement
 break ;
 continue ;
Functions
 Call by value
 Call by reference
Arrays
Arrays
int a [ 10 ] ;

a[0];
:
a[9];
Pointers
Pointers

Memory address of a
variable is stored
inside a pointer
Files and their
Input / Output
systems

You might also like