Programming Fundamentals
Introduction
▪ Purpose: A brief introduction to
  Programming Fundamentals
▪ Lab: The laboratory experiments for
  Programming Fundamentals are an integral
  part of the course
▪ “A precise sequence of steps to solve a
  particular problem”
              Click to add text
▪ Analysis
▪ Critical Thinking
▪ Attention to Detail
▪ To design a program properly, we must:
  – Analyze a problem statement, typically
    expressed as a word problem
  – Express its essence, abstractly and with
    examples
  – Formulate statements and comments in a
    precise language
  – Evaluate and revise the activities in light of
    checks and tests
▪ Objectives of this course are three fold
1. To appreciate the need for a programming
   language
2. To introduce the concept and usability of
   the structured programming methodology
3. To develop proficiency in making useful
   software using the C language
▪ To achieve our first two objectives we will
  be discussing
▪ Basic Programming constructs and building
  blocks
▪ Structured programming
▪ Structured flowcharts, pseudo-code
▪   History of C Language
▪   Variables and expressions in C
▪   Control structures and functions
▪   Arrays and Pointers
▪   Characters and Strings
▪   Structures
▪   File handling
▪   Come to lectures on time and participate
▪   Keep up with reading material
▪   Complete assignments, projects, etc on time
▪   Submit clean, organized, and to the point
    reports
▪ Attendance
  – Pay attention to lectures and keep extra notes
  – Ask questions
▪ Effort
  – Do homework on your own. It’s ok to ask others
    but make your own effort.
▪ Consistency
  – Keep up with reading, and homework
▪ Computer
  – Device capable of performing computations
    and making logical decisions
  – Computers process data under the control of sets
    of instructions called computer programs
▪ Hardware
  – Various devices comprising a computer Keyboard,
    screen, mouse, disks, memory, CDROM, and
    processing units.
▪ Software
  – Programs that run on a computer
     • System Software
     • Application Software
▪ There are two main categories of
  software
▪ System software
▪ Application software
▪ These software often called as computer
  programs written by computer
  programmers using programming
  language.
▪ Program
  – A set of rules for your computers to follow in
    order to achieve a goal
▪ Programmer
  – A person who produces the program
  – A person who makes a living from producing
    programs
▪ Programming language
  – A way for a programmer to write about the set
    of rules
Programmers write programs using
    programming languages.
▪ A computer program is a collection of
  instructions that performs a specific task
  when executed by a computer.
▪ A computer program is usually written by
  a computer programmer in a
  programming language.
▪ A computer programmer, sometimes called a
  coder (especially in more informal contexts), is
  a person who creates computer programs.
▪ Computers are creatures from outer space
▪ They speak strange languages
▪ Programmers study their languages. Therefore,
  they are able to tell the computers what to do
▪ A way to solve problems using a computer
▪ Computer programming is the process of designing
  and building an executable computer program for
  accomplishing a specific computing result.
▪ How?
   – Through a sequence of very clear and defined steps
     (algorithm) using a specific language (programming
     language) that aim to solve the problem
▪ Algorithms are not only used for computer
  programming, they are a general concept for problem
  solving
▪ Programming languages are used in
  computer programming to implement
  algorithms.
▪ Programming languages categories
  – Low-level languages
    • Machine language
    • Assembly language
  – High-level languages
▪ Compilers
  – Compile several machine instructions into short
    sequences to simulate the activity requested by
    a single high-level primitive
  – Produce a machine-language copy of a
    program that would be executed later
  – Convert source code into object code
▪ Interpreters
  – Execute the instructions as they were translated
▪ Source code is the list of human-readable
  instructions that a programmer writes
▪ Object code is the output of a compiler
  after it processes source code.
▪ A way to solve problems using a computer
▪ You are given a problem and asked to write a program
  to solve that problem, e.g. decide whether a number
  input by user is even or odd?
▪ Steps in developing a program
   –   Defining the problem
   –   Analyzing the problem statement
   –   Planning the solution
   –   Coding the program
   –   Testing the program
▪ Documenting the program (optional but important)
   – Commenting
▪ A programming task can be divided into two
  phases:
▪ 1. Problem solving
  – Define : Clearly describe a problem
  – Design its solution (Algorithm): Produce an ordered
    sequence of steps that describe solution to the
    problem;
▪ 2. Implementation phase
  – Implement the program in some programming
    language
  – write code, compile, link, Test & Debug
▪ Defining a Problem:
   – Break the definition of the problem down into manageable steps.
     Example; input, Processing, Output:
▪ Program: Write a program which tells whether the
  temperature entered by user in below freezing point or
  not?
   –   Input ; Read the temperature from keyboard
   –   Processing; Test the Temperature below or above
   –   freezing
   –   Output; Display the result on Screen
▪ Design the solution (Algorithm):
▪ Algorithm
  – A sequence of language independent steps
  – which may be followed to solve a problem.
▪ The word Algorithm comes from the name of the
  muslim author Abu Ja’far Mohammad ibn Musa
  al-Khowarizmi.
▪ Good understanding of algorithms is essential for
  a good programming
▪ Unlike a program, an algorithm is a mathematical
  entity, which is independent of a specific
  programming language, machine, or compiler.
▪ Algorithm design is all about the mathematical
  theory behind the design of good programs
▪ An Algorithm can be developed with a:
▪ Pseudo Code
  – Pseudo code is an informal high level description of the
    operating principle of a computer program or other
    algorithm
▪ Flowchart
  – A flowchart is a type of diagram that represents a
    workflow or process.
▪ Editor
▪ Interpreter and Compilers
▪ Debuggers
▪ It contains
   –   Editor
   –   Compilers
   –   Debugger
   –   Linkers
   –   Loaders