Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
54 views

C Introduction, Algorithm and Pseudo Code

The document outlines key trends in software and hardware that have influenced the evolution of operating systems, including the shift to personal, distributed, and client-server computing, and the rise of object-oriented programming. It also provides details on procedural and object-oriented programming, the C programming development environment, and common program development tools like algorithms, flowcharts, and pseudocode.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

C Introduction, Algorithm and Pseudo Code

The document outlines key trends in software and hardware that have influenced the evolution of operating systems, including the shift to personal, distributed, and client-server computing, and the rise of object-oriented programming. It also provides details on procedural and object-oriented programming, the C programming development environment, and common program development tools like algorithms, flowcharts, and pseudocode.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Unit 1

Introduction to computer
organization, Evolution of
Operating Systems, Data
types and Operators
OUTLINE
• Key software and hardware trends
• Personal, distributed and client server
computing
• Difference between procedural and OOP
• C program development environment
• Program development tools
The Key Software Trend: Object
Technology
• Machine dependent Languages
• Machine independent languages

• Modularity
• Reusability
Hardware Trends
• Every year or two computers approximately
double
– The amount of memory they contain
• Memory used to execute programs
– The amount of secondary storage they contain
• Secondary storage (such as disk storage) is used to to
hold programs and data over time
– Their processor speeds
• The speed at which computers execute their programs
Personal Computing
• 1977 Apple Computer popularized personal computing
– Computers became economical for personal or business use
• In 1981 IBM launch first personal computer
• These computers were quickly & heavily used in business,
industries & government organization
• Personal computers were powerful enough to handle the
computing requirements of individual users as well as the basic
communication tasks of passing information between
computers electronically.
Distributed Computing
• Machines could be linked together in computer networks
– Local area networks (LANs)
– Distributed computing
• Workstations
– Provide enormous capabilities
– Information shared across networks
Client Server Computing
• Servers offer data storage and other capabilities that may be
used by client computers distributed throughout the network,
– Client/server computing
Procedural Programming
• Programming in procedural languages
involves choosing data structures (appropriate
ways to store data), designing algorithms, and
translating algorithm into code.
• Traditional programming languages were
procedural.
–C, Pascal, BASIC, Ada and COBOL
Problems with Procedural
programming language

• Software maintenance can be difficult


• Time consuming
Object-Oriented Programming
• Object-oriented programming is centered on
creating classes and objects rather than
procedures/ functions
• Data in an object are known as attributes
• Class is a data type and object is an instance
of that data type
• Examples- C++, Java,…
Principles of OOP
•Inheritance is the ability to inherit attributes
and behavior from existing classes (base class)
Benefits of Object-oriented
programming
• Modularity
• Code re-use
Save development time (and cost) by reusing code
– once an object class is created it can be used
in other applications
• Easy debugging
– classes can be tested independently
– reused objects have already been tested
C Program Development Environment
 Phases of C Programs:
 Edit (C program file names should end with the .c

extension)
 Preprocess

 Compile

 Link

 Load

 Execute
Editor Program is created in
Disk
the editor and stored
on disk.
Preprocessor Disk Preprocessor program
processes the code.
Compiler creates
Compiler Disk object code and stores
it on disk.
Linker links the object
Linker Disk
code with the libraries,
creates a.out and
Primary
Memory
stores it on disk
Loader

Loader loads the program from disk to


Disk
main memory.
..
..
..

Primary
Memory
CPU
  CPU takes each
instruction and
executes it, possibly
.. storing new data
..
.. values as the program
executes.
C Program Development
Environment(cont.)
• Phase 1: Create your program with an editor program
• Phase 2: A preprocessor find some preprocessor directives
(#include <stdio.h>) to include other files and perform
various text replacements
• Phase 3: Compiler compiles the program into machine
languages (object code != object-oriented programming).
• Phase 4: A linker links the object code with the code in
library or other places to produce an executable image.
• Phase 5: A loader loads the executable image into memory
(RAM).
• Phase 6: CPU executes the program one instruction at a
time. The load process in Windows OS is just input the
name of the executable file (for example, lab01.exe).
Program Development Tools
• Algorithm
• Flow chart
• Pseudo-code
Algorithm
• Algorithm is defined as “ the finite set of
steps, which provide a chain of action for
solving a problem”
• It is step by step solution to given problem.
• Well organized, pre-arranged and defined
textual computational module
1. Actions
2. Sequence of actions
Now Create Algorithm!!
Problem: To get up and reach class in morning
(1)Get out of bed
(2) take a shower
(3) get dressed
(4) eat breakfast
(5) Move out of hostel
(6) Walk towards department
(7) Find your class
Why Sequence is important?
(1) Get out of bed
(2) get dressed
(3) take a shower
(4) eat breakfast
(5) Move out of hostel
(6) Find your class
(7) Walk towards department
Pseudo-Code
• It Means:
FALSE CODE
• It is a more formal representation than the algorithm
• Pseudocode programs are not executed on computers.
• In pseudo code representation
– Each of steps will be written via operators and statements
equivalent to some programming language instructions.
– The only difference will be that the exact syntax of the
programming language will not be followed.
– All pseudo codes will start with the keyword “START” and
complete with the keyword “STOP” or “END”.
Example
Algorithm:
1.Read the value of a
2.Read the value of b
3.Read the value of c
4.Take sum of a, b and c
5.Divide the sum by 3
6.Get the average
7.Print average on computer screen
Pseudo code
1. START
2. Read a, b
3. Sum= a+b+c;
4. Average= a+b+c/3;
5. Print Average
6. STOP

You might also like