lecture-2- intro to programing
TRANSCRIPT
-
7/27/2019 Lecture-2- Intro to Programing
1/22
Introduction to Computer Programming- CSC141
Muhammad Usman Yaseen
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
2/22
Recommended Books:
Text Book / Essential Reading:
Introduction to computers, Peter Norton, 4thEdition
A book on C by Kelly
Reference Books / Literature:
Computer Today, Donald H Sanders, 3rd Edition
Computers, H.L Capron 6th Edition Let us C by Yashvant Kanethar
Turbo c/c++ programming by Robert Lafore
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
3/22
Computer programming
Humans are intelligent and computers are
dumb.
Humans can think on their own, computers
cant.
Humans know what to do, computers dont.
Computers need to know what to do.
They rely on humans.
Humans control computers
Very simply, telling the computer what to
do is called computer programming!Muhammad Usman [email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
4/22
Computer program
A computer needs instructions to perform
a task.
It just cant decide on its own not at all!
The instructions have to be
Detailed
Step by step
Exact Accurate
Complete
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
5/22
computer program
The set of step by step instructions followingwhich, a computer can perform the requiredtask, is known as a computer program.
These instructions Are written by a human being, called a computer
programmer to Control the computer.
Make use of the computers tremendous power to get the
job done.
Computer programming can also be simplydefined as writing computer programs.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
6/22
I/O
Recall that
Every task to be done, problem to be solved
requires some input.
The input need to be processed in a certain
manner.
The processing generates some kind of
results that solve the problem. So input, processing, output is the
simplest way to solve any problem.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
7/22
I/O
It all starts with the output.
Getting the output is the objective.
Feeding the input is a requirement.
Processing the input to get to the output is
what needs to be done.
This is where you solve the problem!
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
8/22
Some examples
Problem: a glass full of orange juice is
needed.
Input: a couple of oranges.
Processing:
1. Cut the oranges
2. Squeeze the oranges
3. Catch the juice flowing out of the oranges
into a glass.
Output: a glass full of orange juice drink
it! Muhammad Usman [email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
9/22
some examples
Problem: shirt needs to be pressed.
Input: a wrinkled shirt.
Processing:1. Heat the iron.
2. Adjust the shirt on a flat surface.
3. Press the shirt with the hot iron until thewrinkles go away.
Output: a wrinkle-free pressed shirt.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
10/22
Computers I/O
Computers also rely on input, processing
and output.
You need to get something done from the
computer, you need the output.
The computer needs relevant input to get
to the output.
It gets the input, processes it, and
generates the output.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
11/22
computers I/O
Computer
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
12/22
Computer program
You want the computer to do something,
you want the output.
You have the required input to get the
output from.
You need the computer to process the
input and give the output, but
The computer doesnt know what to do
remember?
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
13/22
computer program
So you need to tell the computer how to
process the input to get the output.
You will tell it through detailed step by step
instructions.
Step by step instructions are a computer
program.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
14/22
computer program
So you instruct the computer, step by step,
telling it what to do, how to do to
produce the output you need through the
input you feed!
Thus, a computer program instructs the
computer to
Accept the input through input devices.
Process the input and generate the output.
Give the output back through output devices.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
15/22
computer program
Everything that happens inside a computer
is under its processors control.
To make the computer do something, you
need to instruct the processor.
So a computer program instructs the
computers processor to perform the task.
A computer program has instructions
written in it, which a computer can
understand.
Com uter ro ram = com uter software.Muhammad Usman Yaseen
[email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
16/22
computer program
Everything that a computer does isgoverned by a computer program.
There are different programs/software that
make the computer perform differentactivities.
Examples of programs
Microsoft windows Microsoft word
Adobe Photoshop
etcMuhammad Usman Yaseen
[email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
17/22
Programming language
You communicate with humans in a
language they understand.
You need to communicate with a computer
in a language it understands.
The language a computer understands is
called Machine Language.
Its extremely complicated.
So complicated that its not understandable for
humans.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
18/22
programming language
To communicate with somebody who
doesnt understand your language, you
need to translate your language into his
language.
To communicate with a computer, you
need to
Write instructions in a language that you
understand.
Translate those instructions into machine
language that the computer understands.Muhammad Usman [email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
19/22
programming language
A language which you use to writecomputer programs is called programminglanguage.
The language you write programs in has to beone that you can understand.
Programming languages that humans canunderstand are known as high level languages.
The computer only understands machinelanguage.
You need to write programs in high levellanguages and convert/translate them into
machine language.Muhammad Usman [email protected] to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
20/22
Coding
A computer program you write in a high
level language is also referred to as
Source Code.
Programming is also referred to as
Coding.
A person who writes computer programs is
sometimes referred to as a Coder.
The word Programmer is more appropriate
and more common.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
21/22
Translator
Microsoft Word is a computer program
which helps you compose text documents.
Microsoft Paint is another program which
helps you draw images.
Similarly, there are programs you use to
translate programs you write in high level
languages into corresponding machine
language.
Muhammad Usman [email protected]
Introduction to ComputerProgramming- CSC141
-
7/27/2019 Lecture-2- Intro to Programing
22/22
translator
A program that translates the entire source
code into its machine language equivalent
in one go is called a Compiler.
Compiler is said to compile the source code.
A program that translates the source code
into its machine language instruction by
instruction is called an Interpreter. Interpreter translates one instruction at a time.
Muhammad Usman Yaseenusman [email protected]
Introduction to ComputerProgramming- CSC141