Programming Fundamentals for Software Engineering
Programming Fundamentals for Software Engineering
Programming Fundamentals
4.00 Credit Hours
Undergraduate Program
© www.uskt.edu.pk
Your Introduction Please
• Introduction Please introduce yourself briefly
• Course • Name
Introduction
• Academic Background
• Computer
Organization • Previous knowledge of Programming
Languages
• Software
Categories • Any Software Project (if any)
• Programming
• educational/ commercial
Languages
• Programming
Tools
• C++ Language
Course Introduction
• Introduction
• Course
Introduction
• Credit Hours: 4.00
• Computer
Organization
• Pre-requisite: Nil
• Software
Categories
• Programming
• Course Resources: Lecture slides,
Languages assignments, quizzes, solutions to
• Programming problems, project/presentation
Tools
• C++ Language
Learning Approach
• Introduction
• Course material will be presented by the
• Course
instructor
Introduction
• Lectures will not cover every part of a chapter
• Computer • Some lecture material will not appear in the
Organization
book
• Software
Categories
• As a general principle, a student must
regularly consult the books and the material
• Programming
Languages
provided.
• Dependency on the slides not recommended
• Programming
Tools • Consult the books, discuss in the class and,
explore the resources.
• C++ Language
Course Objectives
• Introduction
Upon completing this course, students should
be able to:
• Course
Introduction • Prepare programs using top down structured
design
• Computer • Perform problem solving skills
Organization
• Understand the syntax and concepts of C++
• Software
programming language
Categories • Design, create, test and debug c programs
• Developed programs that are both
• Programming
Languages
syntactically and logically correct
• Understanding of basic designing techniques
• Programming of programming language
Tools
• Hands on experience of different C++
• C++ Language
constructs
Grading
• Introduction • Quizzes 10 %
• Course
• No makeup
Introduction
• Assignments 10 %
• Computer • Time bound/ late submission not allowed
Organization
• Midterm 30 %
• Software
Categories • Term Project/Presentation 10 %
• Programming • Final Exam 40 %
Languages
• Programming
Tools
• C++ Language
Books
• Introduction Text Book
• Course • C++ How to Program by Deitel and Deitel
Introduction
• Computer
Organization
• Software
Categories Reference Books
• Programming 1. Let us C++ by Yashwant Kantaker
Languages
2. Hanly Koffman – Problem Solving &
• Programming Program Design in C++ – Addison Wesley
Tools
• C++ Language
Computer Organization
• Introduction Regardless of differences in physical
• Course appearance, virtually every computer may be
Introduction
divided into six logical units/sections
• Computer
Organization 1. Input unit
• Software 2. Output unit
Categories
3. Memory unit
• Programming
Languages
4. Arithmetic and logic unit (ALU)
• Programming
Tools 5. Central processing unit (CPU)
• C++ Language 6. Secondary storage unit
Computer Organization
• Introduction Input unit
• Course • Receiving section that
Introduction
• Obtains information from input devices
• Computer
Organization
• Places it at the disposal of the other units for
further processing
• Software
Categories • Information can be entered in many ways
by
• Programming
Languages • scanning images and barcodes,
• Programming • reading from secondary storage devices
Tools • and having your computer receive information
• C++ Language
from the Internet
Computer Organization
• Introduction
Output unit
• Course • “Shipping” section that
Introduction
• takes information that the computer has processed
• Computer • places it on various output devices to make it
Organization
available for use outside the computer.
• Software
Categories • Information that is output from computers is
• displayed on screens
• Programming
Languages • printed on paper
• played on audio players
• Programming
Tools • sent to networks such as the Internet
• C++ Language
Computer Organization
• Introduction Memory unit
• Course • Rapid-access, relatively low-capacity
Introduction
“warehouse” that retains
• Computer
Organization
• information that has been entered through input
unit, making it immediately available for
• Software processing when needed
Categories
• Processed information until it can be placed on
• Programming output devices by the output unit.
Languages
• Information in the memory unit is volatile
• Programming
Tools • i.e. lost when the computer’s power is turned off
• C++ Language
• Also called memory or primary memory
Computer Organization
• Introduction Arithmetic and logic unit (ALU)
• Course
Introduction • This “manufacturing” section
• Computer • performs calculations, such as addition,
Organization
subtraction, multiplication and division.
• Software
Categories • Contains decision mechanisms, for example,
comparing two items whether they are equal
• Programming
Languages
• In today’s systems, the ALU is usually
• Programming
Tools implemented as part of the CPU.
• C++ Language
Computer Organization
• Introduction Central processing unit (CPU)
• Course • “administrative” section
Introduction
• Coordinates and supervises the operation
• Computer
Organization of other sections
• Software • CPU tells the
Categories
• Input unit when to read information into memory
• Programming unit
Languages
• ALU when information from memory unit be
• Programming used in calculations
Tools
• Output unit when to send information from the
• C++ Language memory unit to certain output devices.
Computer Organization
• Introduction Secondary storage unit
• Course
Introduction • Long-term, high-capacity “warehouse”
• Computer
Organization
• Program/data not actively used by the
• Software
other unit are placed on secondary
Categories
storage devices e.g. hard drive
• Programming
Languages • Information is persistent
• Programming
Tools i.e. preserved even when the computers
power is turned off
• C++ Language
Software Categories
• Introduction 1. System software
• Course
Introduction
• Communicates with/ operates
computer’s hardware
• Computer
Organization • Provides platform for application
• Software software
Categories
2. Application software
• Programming
Languages
• designed for end users
• Programming
Tools • to perform helpful tasks beyond the
• C++ Language
running of computer itself
Software Categories
• Introduction System Software
• Course
Introduction To communicate with or to operate
• Computer computer hardware like
Organization
• Software
• Operating system
Categories
• Utility software
• Programming
Languages
• Device driver
• Programming
Tools • Compilers/Assemblers
• C++ Language
Software Categories
• Introduction Operating system (System Software)
• Course
Introduction • To manage all other programs running
• Computer on a computer
Organization
• Software
• Manages and supervises all resources
Categories
like CPU time, memory space
• Programming
Languages • Examples: Microsoft Windows, Linux
• Programming
Tools
• C++ Language
Software Categories
• Introduction Device Driver (System Software)
• Course
Introduction • to communicate between a device and
• Computer the computer.
Organization
• Software
• Examples: drivers for sound card.
Categories
• Programming
Languages
• Programming
Tools
• C++ Language
Software Categories
• Introduction Utility (System Software)
• Course
Introduction • Performs a specific task usually related
• Computer to manage system resource
Organization
• Software
• Analyze, configure and maintain the
Categories
computer
• Programming
Languages • Examples: Disk defragmentation, disk
• Programming cleaner
Tools
• C++ Language
Software Categories
• Introduction Application Software
• Course
Introduction Software designed for end users to
• Computer perform helpful tasks beyond the running
Organization
of computer itself
• Software
Categories
• Spreadsheets
• Programming
Languages • Word processors
• Programming
Tools • Computer Games
• C++ Language • Graphics
Programming Language
• Introduction
• Course
Introduction
• Computer
Organization
• Software
Categories Language?
• Programming
Languages
• Programming
Tools
• C++ Language
Programming Languages
• Introduction Program: computer process data under
• Course
Introduction
the control of sets of instructions called
• Computer
computer program.
Organization
Software: the programs that runs on a
• Software
Categories computer are referred to as software.
• Programming
Languages Programming language: a notational
• Programming system intended primarily to facilitate
Tools
human-machine interaction.
• C++ Language
Programming Languages
• Introduction
• Course
Introduction 1. Machine language
• Computer
Organization
2. Assembly language
• Software 3. High level language
Categories
• Programming
Languages
• Programming
Tools
• C++ Language
Programming Languages
• Introduction Machine Language
• Course • “Natural language” of a computer
Introduction
• Computer can directly understand only its
• Computer
Organization own language
• Software • Generally consists of strings of numbers
Categories
(ultimately reduced to 1s and 0s)
• Programming
Languages
• Instructs computers to perform their most
elementary operations
• Programming
Tools • Machine languages are machine
• C++ Language dependent
Programming Languages
• Introduction Machine Language
• Course
Introduction • Section of an early machine-language
• Computer program
Organization
+1300042774
• Software
Categories +1400593417
• Programming +1200274027
Languages
• Too slow, tedious and error prone for
• Programming
Tools most programmers
• C++ Language
Programming Languages
Assembly Language
• Introduction
• Course
• English like abbreviations to represent elementary
Introduction operations
• Computer
• These abbreviations formed the basis of assembly
Organization language
• Software • Assembler: translate assembly language program
Categories to machine language
load basepay
• Programming
Languages add overpay
store grosspay
• Programming
Tools • Programmers still had to use many instructions to
accomplish a simple task.
• C++ Language
Programming Languages
• Introduction High Level Language
• Course
Introduction • almost English like language
• Computer
Organization
• substantial tasks are accomplished
• Software
through single statements
Categories
• Examples: C++, C++, Java
• Programming
Languages
• Programming
Tools
• C++ Language
Programmers Tools
• Introduction • Editor
• Course
Introduction • Compiler/Interpreter
• Computer
Organization
• Debugger
• Software • Linker
Categories
• Programming
• Loader
Languages
• Programming
Tools
• C++ Language
Programmers Tools
• Introduction Editor
• Course
Introduction • Used to write a piece of code
• Computer • This human readable code is called source code
Organization
• Simple text editors can be used as an
• Software
Categories
editor
• Programming
Languages • C++ program files end with .cpp
• Programming extension
Tools
• C++ Language
Programmers Tools
• Introduction Compiler
• Course
Introduction • translator that translates high level
• Computer language into machine language
Organization
• Software
• converts human readable code (source
Categories
code) to machine readable code (object
• Programming
Languages code)
• Programming • translates whole program in one go and
Tools
gives complete picture of the program
• C++ Language
Programmers Tools
• Introduction Interpreter
• Course
Introduction • translator that translates high level
• Computer language into machine language
Organization
• Software
• Line by line translation therefore
Categories
program executes slowly
• Programming
Languages • doesn’t give complete picture of the
• Programming program
Tools
• C++ Language
Programmers Tools
• Introduction Debugger
• Course
Introduction • Helps to debug the program i.e. rectify
• Computer the errors
Organization
• Software
Helps in tracing the logical errors
Categories
• Programming
Languages
• Programming
Tools
• C++ Language
Programmers Tools
• Introduction Linker
• Course
Introduction • links the object code with libraries
• Computer
Organization
• The process is called linking
• Software • Converts object code to single
Categories
executable code
• Programming
Languages
• Programming
Tools
• C++ Language
Programmers Tools
• Introduction Loader
• Course
Introduction • Loads the executable program into
• Computer memory
Organization
• Software
• Process is called loading
Categories
• Programming
Languages
• Programming
Tools
• C++ Language
C++ Language
History of C++ Language
• Introduction
• a general-purpose operating system is written in C or C++
• Course
Introduction • C developed between 1969 and 1973 by Dennis Ritchie at the
Bell Telephone Laboratories for use with the UNIX operating system.
• Computer
Organization • C++, an extension of C, was developed by Bjarne Stroustrup in
• Computer
Organization
• Software
Categories
• Programming
Languages
• Programming
Tools
• C++
Language
C++ Programming Environment
• Introduction Hence C++ programs typically go through
• Course six phases
Introduction
• Computer
1. Edit
Organization
2. Preprocess
• Software
Categories 3. Compile
• Programming
Languages
4. Link
• Programming 5. Load
Tools
6. Execute
• C++
Language
Some common escape sequences
• Programming
Tools
• C++
Language
Sample C++ Program
• Introduction
/* My First Program in C++ */
• Course
#include <iostream>
Introduction using namespace std;
/*function main begins program execution */
• Computer
Organization int main ()
{
• Software
Categories
cout<<“Welcome to C++\n”;
• Programming
Languages
return 0;
• Programming
Tools
}/*end function main */
• C++
Language
References
• Introduction C++ How to Program by Deitel and Deitel – 10th
• Course edition
Introduction
• Computer
Organization
• Software
Categories
• Programming
Languages
• Programming
Tools
• C++ Language