Fundamentals of Programming (Lec 1)
Fundamentals of Programming (Lec 1)
Programming
Ms. Humael Hussain
[email protected]
FUNDAMENTALS OF PROGRAMMING 2
The Course
› Fundamentals of Programming (CSPF-121)
› Credit Hours (3+0)
› Semester [BSCS-1]
FUNDAMENTALS OF PROGRAMMING 3
The Course
› Make or break course
› Be regular and consistent; do not skip classes
› Practice a lot!
› Be on the time
› Modules
– Functional C++
– File Handling
› Text book
– C++ How to Program by H.M. Deital and P.j. Deital , 7th Edition
– Beginning C++ by Ivor Horton, 3rd Edition
FUNDAMENTALS OF PROGRAMMING 4
Evaluation Criteria
Weighting of Assessments for Theory
Quizzes 5-10%
Assignments 5-10 %
Semester Project 5-10 %
Mid-semester examination 25 %
End-semester examination 50 %
FUNDAMENTALS OF PROGRAMMING 5
Evaluation Criteria
Weighting of Assessments for Lab
Each lab evaluation 60 %
Final Lab Exam 25 %
Project 15 %
FUNDAMENTALS OF PROGRAMMING 6
Grading Policy
Introduction to Programming
A programming language is a set of symbols, grammars
and rules with the help of which one is able to translate
algorithms to programs that will be executed by the
computer.
The programmer communicates with a machine using
programming languages.
Most of the programs have a highly structured set of rules.
FUNDAMENTALS OF PROGRAMMING 9
Introduction to Programming
› Programmers write instructions in various programming
languages, some directly understandable by computers
and others requiring intermediate translation steps.
› These may be divided into three general types:
– Machine languages
– Assembly languages
– High-level languages
FUNDAMENTALS OF PROGRAMMING 10
Machine Languages
Machine language is a low-level programming language
made out of binary numbers or bits that can only be read by
machines.
It is easier for machine to understand but harder for the
programmer to understand.
High Level Languages
Languages uses English like statements and symbols.
Independent of the type of computer you are using.
Easy to understand.
For Example: C++, C #, java, kotlin, Python, etc
Why Programming is Important?
Why Programming is Important?
Programming is important to innovate and create eco-
friendly solutions for global problems.
It is important in our daily life to enhance and increase the
power of computers and the internet.
Characteristics of a programming Language
› A programming language must be simple, easy to learn
and use, have good readability, and be human
recognizable.
› A programming language should be well structured and
documented so that it is suitable for application
development.
› A programming language must be consistent in terms of
syntax and semantics.
› Necessary tools for the development, debugging,
testing, maintenance of a program must be provided by
a programming language.
Benefits of Learning Programming Languages
› Helps you to understand technology
› Sharpen your Problem Solving Skills
› Employment Prospects
› Automate your Business
› Become more Technically Minded
› Build Superb Websites
› Analyse and Visualise Data
Some Programming Languages
Generations of Programming Languages
First-Generation Languages :
These are low-level languages like machine language.
Second-Generation Languages :
These are low-level assembly languages used in kernels
and hardware drives.
Third-Generation Languages :
These are high-level languages like C, C++, Java, Visual
Basic, and JavaScript.
Generations of Programming Languages
Fourth Generation Languages :
These are languages that consist of statements that are
similar to statements in the human language. These are
used mainly in database programming and scripting.
Examples of these languages include Perl, Python, Ruby,
SQL, and MatLab(MatrixLaboratory).
Fifth Generation Languages :
These are the programming languages that have visual tools
to develop a program. Examples of fifth-generation
languages include Mercury, OPS5, and Prolog.
First-generation languages
The first-generation languages are also called machine languages/ 1G
language. This language is machine-dependent. The machine
language statements are written in binary code (0/1 form) because the
computer can understand only binary language.
Advantages :
1. Fast & efficient as statements are directly written in binary language.
2. No translator is required.
Disadvantages :
1. Difficult to learn binary codes.
2. Difficult to understand – both programs & where the error occurred.
Second-generation languages
The second-generation languages are also called assembler
languages/ 2G languages. Assembly language contains human-
readable notations that can be further converted to machine language
using an assembler.
Assembler – converts assembly level instructions to machine-level
instructions.
Second-generation languages
Advantages :
1. It is easier to understand if compared to machine language.
2. Modifications are easy.
3. Correction & location of errors are easy.
Disadvantages :
1. Assembler is required.
2. This language is architecture /machine-dependent, with a different
instruction set for different machines.
Third-generation languages
The third generation is also called procedural language /3 GL. It
consists of the use of a series of English-like words that humans can
understand easily, to write instructions. It’s also called High-Level
Programming Language. For execution, a program in this language
needs to be translated into machine language using a Compiler/
Interpreter. Examples of this type of language are C, PASCAL,
FORTRAN, COBOL, etc.
Third-generation languages
Advantages :
1. Use of English-like words makes it a human-understandable
language.
2. Lesser number of lines of code as compared to the above 2
languages.
3. Same code can be copied to another machine & executed on that
machine by using compiler-specific to that machine.
Disadvantages :
1. Compiler/ interpreter is needed.
2. Different compilers are needed for different machines.
Fourth-generation languages
The fourth-generation language is also called a non – procedural
language/ 4GL. It enables users to access the database. Examples:
SQL, Foxpro, Focus, etc.
These languages are also human-friendly to understand.
Advantages :
1. Easy to understand & learn.
2. Less time is required for application creation.
3. It is less prone to errors.
Disadvantages :
1. Memory consumption is high.
2. Has poor control over Hardware.
3. Less flexible.
Fifth-generation languages
The fifth-generation languages are also called 5GL. It is based on the
concept of artificial intelligence. It uses the concept that rather than
solving a problem algorithmically, an application can be built to solve it
based on some constraints, i.e., we make computers learn to solve any
problem. Parallel Processing & superconductors are used for this type
of language to make real artificial intelligence.
Examples: PROLOG, LISP, etc.
Fifth-generation languages
Advantages :
1. Machines can make decisions.
2. Programmer effort reduces to solve a problem.
3. Easier than 3GL or 4GL to learn and use.
Disadvantages :
1. Complex and long code.
2. More resources are required & they are expensive too.
Introduction to C++
› C++ evolved from C, which was developed by Dennis Ritchie
at Bell Laboratories.
› C
– Available for most computers and is hardware independent.
– It’s possible to write C programs that are portable to most computers.
– The widespread use of C with various kinds of computers (sometimes
called hardware platforms) led to many variations.
– American National Standards Institute (ANSI) cooperated with the
International Organization for Standardization (ISO) to standardize C
worldwide.
– Joint standard document was published in 1990 and is referred to as
ANSI/ISO 9899: 1990.
FUNDAMENTALS OF PROGRAMMING 30
Introduction to C++
› C++, an extension of C, was developed by Bjarne
Stroustrup in 1979 at Bell Laboratories.
› C++ provides a number of features that “spruce up” the C
language, but more importantly, it provides capabilities for
object-oriented programming.
FUNDAMENTALS OF PROGRAMMING 31
A simple Program
// A simple program to print a line
//Begins execution
int main(int argc, char** argv) {
cout<<"Hello World\n";
return 0; //Program exited successully
}//End of Function
FUNDAMENTALS OF PROGRAMMING 32
Thanks!
FUNDAMENTALS OF PROGRAMMING 33