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.
MarksPassing 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
}
3.
Learning Philosophy
Lecturesprovide 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.
4.
Remember
This courseis 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.
5.
Books
Deitel &Deitel :– C++ How to Program
Robert Lafore : Object-Oriented Programming in C++
6.
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.
7.
What is aComputer
A Computer is an Electronic Device, Which takes input, process that input
and output/Display/store the results.
8.
Computer Hardware vsSoftware
Hardware are Physical Devices Software are Programs that governs the
functioning of the computer
What is aprogram
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.
11.
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.
12.
Why Programming isimportant
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
13.
What skills areneeded
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
1. Algorithm
Stepby 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.
16.
Algorithm Example
Exampleof 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
17.
2-Pseudo code
Pseudomeans “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
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
20.
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
21.
Example
Original ProgramSpecification
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
22.
3-Flow Chart
Logicdiagram 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
23.
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.
24.
Example of Flowchart:
Make a flow chart to output a person
Can live alone or not
based on their weekly pay per hour.
25.
Program Development Process
Designing and Analyzing Problem
Designing the Algorithm
Coding or Writing the Program
Testing The Program
Final Documentation
26.
Programming Languages
Setof 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
27.
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.
28.
Language Processor
Aswe 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
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