0% found this document useful (0 votes)
257 views

1 Introduction To Programming

This document outlines the course policy, learning philosophy, objectives, and an introduction to programming fundamentals for a 4 credit hour programming course. It discusses the distribution of marks between assignments, exams, and practical work. The learning philosophy emphasizes lectures, labs, assignments, and exams to build understanding. The course objectives are to appreciate programming languages, introduce structured programming methodology, and develop C language proficiency. An introduction to computers, software, algorithms, pseudo-code, and flowcharts is also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
257 views

1 Introduction To Programming

This document outlines the course policy, learning philosophy, objectives, and an introduction to programming fundamentals for a 4 credit hour programming course. It discusses the distribution of marks between assignments, exams, and practical work. The learning philosophy emphasizes lectures, labs, assignments, and exams to build understanding. The course objectives are to appreciate programming languages, introduce structured programming methodology, and develop C language proficiency. An introduction to computers, software, algorithms, pseudo-code, and flowcharts is also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Programming Fundamentals

Introduction

AFZAAL HUSSAIN
Course Policy :

 Policy for the distribution of marks and examination is as follows


 Programming Fundamentals is a 4 credit hour course 4 ( 3 – 1 ).
 3 Credits of theory and 1 Credit hour of practical.

 Marks Passing Marks

}
 Attendance, Class Work, Assignments and Quizzes [ 12 Marks ]
 Midterm Examination [ 18 Marks ] 24 Marks
 Final Examination [ 20 Marks ]
 Practical Examination [ 20 Marks ] 08 Marks
Learning Philosophy

 Lectures provide the first pass at course materials. They provide preliminary
understanding and knowledge.
 Labs provide a more interactive environment which helps to clarify further
understanding of the course materials. This activity also provides first hand
implementation of problems using C/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.
Remember

 This course is for you!


 This course will build your strong foundation for upcoming courses of the degree.
 If you have questions, or any suggestions, please let me know.
 Course material Notes, slides, programs, Books and lecture videos will be placed
at link below
www.bit.ly/afzaal_gcuf
 You can always ask me questions via e-mail at
[email protected]
Books

 Deitel & Deitel :– C++ How to Program


 Robert Lafore : Object-Oriented Programming in C++

 You can download books and course material from link below
 www.bit.ly/afzaal_gcuf

Course Objectives :

 Objectives of this course are three fold


 To appreciate the need for a programming language
 To introduce the concept and usability of the structured
programming methodology
 To develop proficiency in making useful software using the C
language.

 This is the basic course of programming, but its lessons extend


to any language you might want to learn.
What is a Computer

 A Computer is an Electronic Device, Which takes input, process that input


and output/Display/store the results.
Computer Hardware vs Software

Hardware are Physical Devices Software are Programs that governs the
functioning of the computer
Remember

 Computers are STUPID


 The computer only knows what the programmer tells it to do

 Humans are even more…


What is a program

 Definition: "A program is a precise sequence of steps to solve a particular


problem.”

 It means that when we say that we have a program, it actually means that we
know about a complete set activities to be performed in a particular order.

 The purpose of these activities is to solve a given problem.


Program design recipe

 Learning to design programs is like learning to play soccer.


 A player must learn to trap a ball, to dribble with a ball, to pass, and to shoot a
ball.
 Once the player knows those basic skills, the next goals are to learn
 To play a position,
 To play certain strategies,
 To choose among feasible strategies, and, on occasion,
 To create variations of a strategy because none fits.
Why Programming is important

 Learning to program is important because it develops analytical and


problem solving abilities. It is a creative activity and provides us a mean to
express abstract ideas.
 Thus programming is fun and is much more than a vocational skill.
 By designing programs, we learn many skills that are important for all
professions.
 These skills can be summarized as:
 Critical reading
 Analytical thinking
 Creative synthesis
What skills are needed

 Programming is an important activity as people life and living depends on the


programs one make.
 Hence while programming one should
 Paying attention to detail
 Think about the reusability.
 Think about user interface
 Understand the fact the computers are stupid
 Comment the code liberally
Programming Tools

1. Algorithms
2. Pseudo code
3. Flowchart
1. Algorithm

 Step by step method of performing any task is called as Algorithm.


 Breaking up a big task in to smaller steps to make it easy to perform.
 Brushing teeth, making tea, getting ready for school/office are
examples of some sort of algorithms .
 Each step of the algorithm is called as Instruction.
 Algorithms are key to solving many problems efficiently.
Algorithm Example

 Example of making tea :


 Begin
 Boil water
 Put tea powder in the kettle
 Pour boiled water in the kettle
 Wait for three minutes
 Boil milk
 Put boiled milk in a cup
 Add sugar to the cup
 Empty the kettle in the cup
 Stir the cup with a spoon
 End
2-Pseudo code

 Pseudo means “pretended” / “not real”


 A program design technique that uses English like words.
 Has no formal syntactical rules.
 The idea is to represent the algorithm in a form that is in between
pure English and actual Running code.
 Actually it’s one of the way for expression of Algorithm.
 It is a written statement of an algorithm using a restricted and well-
defined vocabulary
Pseudo code Vocabulary

 1. Input/output
 2. Iteration
 3. Selection/Decision
 4. Processing
seudo code - Input/output

 Input
 INPUT, READ
Used to get values from a data source, for example from a keyboard
 INPUT age
 Output
 DISPLAY, PRINT, WRITE
Used to output values to a data sink, a screen or printer
 DISPLAY new_value
seudo code - Iteration or Loop

 FOR <var> = <start value> to <stop value>


 LOOP
statement(s)
 END LOOP
 FOR count = 1 to 10
 LOOP
DISPLAY count
 END LOOP
Example

 Original Program Specification


 Write a program that obtains two numbers from the user. It will print out the sum of those numbers.
 Pseudo code
DISPLAY the message to enter the first integer
READ user’s first integer input
DISPLAY the message to enter the second integer
READ user’s second integer input
COMPUTE first integer + second integer GIVING sum
DISPLAY an output message that explains the answer as the sum
DISPLAY the sum
3-Flow Chart

 Logic diagram to describe each step that the program must perform to arrive at the
solution.
 Flow Chart is a popular logic tool used for showing an algorithm in graphics form.
 Programmer prepares flowchart before coding.

 Most common flowchart symbols are:

Flow line Terminal Input/Ouput Decision Processing


Purpose of Flowcharting

 An aid in developing the logic of a program.


 Verification that all possible conditions have been considered in a program.
 Provides means of communication with others about the program.
 A guide in coding the program.
 Documentation for the program.
Example of Flowchart:

 Make a flow chart to output a person


Can live alone or not
based on their weekly pay per hour.
Program Development Process

 Designing and Analyzing Problem


 Designing the Algorithm
 Coding or Writing the Program
 Testing The Program
 Final Documentation
Programming Languages

 Set of words, symbols and codes used to write programs is


called Programming Languages.
 Low Level Programming Languages (Close to Machine )
1. Machine Language
2. Assembly Language
 High Level Programming Languages ( Close to Human )
1. Procedural Programming Languages
2. Object Oriented Programming Languages
3. Non-Procedural Programming Languages
Type of Code

 There are two types of codes


 Source Code
A program written in high level programming language is called
source code. Computer cannot understand this code directly. It is
converted into object code before execution.
 Object Code
A program in machine language is called object code. Also called
machine code. Computers can understand and process this code
directly.
Language Processor

 As we know computers understand only machine language. Program


written in any high level language cannot be run on computer directly.
 It must be converted into machine language before execution.
 Language processor or Translator are the software's that converts a
program into machine language.
 Language Translators are
1. Compiler
2. Interpreter
3. Assembler
Programming Techniques

 Structured Programming
 Sequential Programming
 Conditional Programming
 Iterative Programming
 Function calls
 Object Oriented Programming
 Event Driven Programming
 Visual Programming
C Programming Language

 Developed in 1972 by Dennis Ritchie at AT & T Bell


 Labs (American Telephone & Telegraph Company)
 Very widely used general purpose programming language
 Available on many machines and operating systems
 Design to be flexible and powerful
 Originally a replacement for assembly language (middlelevel)
 C requires extreme care in programming
 C++ is a superset of C
Tips to Success
Try more exercises and more practice

3
Work hard

3
Do the labs and
assignments by
yourself

3
Be patient with
the machine

3
If you really need that, do it quietly ...

13
Please don’t go to home
with a bundle of questions
14
in your mind!

Programming Fundamental-I 3/3/2018

You might also like