Basic Computer Engineeting - Unit 2
Basic Computer Engineeting - Unit 2
Computer
Engineering
(BT-205)
Unit-2
Prof. Mahima Jain
Department of
Computer Science and
Engineering
Contents
Algorithm
Flowchart
Complexities
Introduction to Programming
Categories of Programming Languages
Program Design
Characteristics or Concepts of OOP
Procedure Oriented Programming VS
of inputs.
Example 1: Print 1 to 20:
Algorithm:
Step 1: Initialize X as 0,
Step 2: Increment X by 1,
Step 3: Print X,
Step 4: If X is less than 20 then go back to
1. Terminal:
The oval symbol indicates Start, Stop and
flowchart.
2. Input/Output:
2. Logical Error
Compile the program
3. Runtime Error
Run the program
Categories of Programming Languages
1) Alphabets : A,B,C…,a,b,c…
2) Digits : 0-9
Types of token
I. Keywords
II. Identifiers
III. Constants
IV. Operators
V. Special symbols
Keywords:-
Identifier:-
float Function
char
void
Program Structure
Control statement
To control the flow of Execution of programe
we are using control flow statement
There are three types of control statement
1. Break
Jump
2. Continue
statement
3. Go to
Condition control statements :-
The Condition control statements are the
decision making statements that decides
the order of execution of statements based
on the conditions.
Base
address
address
Two Dimensional Array
An array of arrays is known as 2D array. The
two dimensional (2D) array in C++
programming is also known as matrix. A
matrix can be represented as a table of
rows and columns.
Representation of 2-D
Array
Datatype arrayname [Row] [column];
Ex. Int a[3][3];
Column index
0 1 2
A[0][0] A[0][1] A[0][2]
Row index
Syntax:
return_type function_name (parameter_list)
{
//C++ Statements
}
Why do we need functions?
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.
Functions make code modular. Consider a
big file having many lines of codes. It
becomes really simple to read and use the
code if the code is divided into functions.
Functions provide abstraction. For example,
we can use library functions without
worrying about their internal working.
Example
Types of Function
Default Function: no parameter are there.