5. Are these your motivation?
Because many people take it
Just a random choice, no particular reasons
A required course
I would like to just get a better grade
I would like to get programming skills and then grades
More …
6. I believe your REAL motivation is ...
I take it because I
am interested
7. See course outline for : Course Objectives, Outcomes, Weekly
Lecture Plan, Assessment, Grading Scheme, Textbooks etc.
15. Learning Philosophy
· Lectures provide the first pass at course materials.
They provide preliminary understanding and knowledge.
· Labs provide a more interactive environment in which
help is available to clarify further understanding of the
course materials. This activity also provides first hand
implementation of problems using C.
· Assignments provide more complicated exercises to
understand the concepts of the course. Implementation
of a problem re-inforces the concepts of writing a
program in C.
· Quiz and Examinations test your knowledge of the
course materials covered.
16. This course is for you!
This course will build your strong foundation
for upcoming courses of the degree
Without the students the university wouldn’t
exist
If you have questions, or any suggestions,
please let me know
You can also always ask me questions via e-ma
At: MadihaTariq777@gmail.com
19. 3/3/2018Programming Fundamentals
19
Five main components
Input devices
Allows the user to input data for processing
Output devices
To display the output to the monitor or
getting printed copy
Processor CPU
CU ALU
AU LU
Main memory
Memory locations containing the running
program
Secondary memory
Permanent record of data often on a disk
Background
Computer Systems
20. 3/3/2018Programming Fundamentals
20
Processor Typically called the CPU
Central Processing Unit
Follows program instructions
Typical capabilities of CPU include:
add
subtract
multiply
divide
move data from location to location
Background
Computer Systems
21. 3/3/2018Programming Fundamentals
21
Data:
Raw facts and figures provided as input to computer
Information:
Data After Processing by computer is called information
Computer
Data Information
Background
Data & Information
22. 3/3/2018Programming Fundamentals
22
A computer program is…
A set of instructions written in a sequence to solve a particular
task.
Computer software is …
The collection of programs used by a computer
Includes:
• Editors
• Translators
• System Managers
• Operating Systems
• Games etc
Background
Computer Program
23. 3/3/2018Programming Fundamentals
23
Computer understands Machine Language
‘A’ may look like 01000001
65 may look like 01000001
An instruction may look like 01000001
Programming Languages
Types
High Level Languages (C, C++, Java, Pascal, Visual Basic,
FORTRAN, COBOL, Lisp, Scheme, Ada)
Low Level Languages (Assembly Language)
Background
Programming Languages
24. 3/3/2018Programming Fundamentals
24
High – Level languages
Resemble human languages
Are designed to be easy to read and write
Must be translated to zeros and ones for the CPU
to execute a program
Background
Programming Languages
25. 3/3/2018Programming Fundamentals
25
Low – Level Languages
An assembly language command such as
ADD X Y Z
might mean add the values found at x and y
in memory, and store the result in location z.
Assembly language must be translated to
machine language (zeros and ones)
0110 1001 1010 1011
The CPU can follow machine language
Background
Programming Languages
26. 3/3/2018Programming Fundamentals
26
Translate Programming language to
machine language
Code in
Programming
Language
Language Translator
Code in
Machine
Language
Assembler
(Translates low level or assembly language
program into machine code and also check errors)
Compiler
(Translates High level language
program into machine code and also check errors)
Translator Types
Background
Language Translators
27. 3/3/2018Programming Fundamentals
27
Translate high-level language to machine language
Source code
the original program in a high level language
Object code
the translated version in machine language
Source Code
(Code in High Level
Language)
Language Translator
Object Code
(Code in Machine
Language)
Background
Source Code and Object Code
30. 3/3/2018Visual Programming
30
Problem: To develop a software that get two numbers, calculate sum and then displays the result on screen.
Abstraction
Algorithm
1. Start
2. Input A
3. Input B
4. Sum=A+B
5. Display Sum
6. En
Computer Program (Code)
#include<stdio.h>
int main()
{
int a, b, c;
printf("Enter two numbers to addn");
scanf("%d%d",&a,&b);
c = a + b;
printf("Sum of entered numbers = %dn",c);
return 0;
}
For Example
Compile
and Run
Output
Sum=A+B
31.
32.
33. What makes a bad program?
Writing Code without detailed
analysis and design
Repeating trial and error without
understanding the problem
Debugging the program line by
line, statement by statement
Writing tricky and dirty
programs
34. PROGRAMMER'S
DRINKING SONG!!
100 little bugs in the code,
100 bugs in the code,
fix one bug, compile it again,
101 little bugs in the code.
101 little bugs in the code …
Repeat until BUGS = 0
—The Internet Joke Book