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

CPP-Lecture-01 E..

The document outlines a course on programming fundamentals using C++, including an overview of the course structure, schedule, recommended textbooks, and topics to be covered such as data types, operators, functions, arrays, and file input/output.

Uploaded by

jiamah2005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

CPP-Lecture-01 E..

The document outlines a course on programming fundamentals using C++, including an overview of the course structure, schedule, recommended textbooks, and topics to be covered such as data types, operators, functions, arrays, and file input/output.

Uploaded by

jiamah2005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Programming Fundamentals

(Using C++)
Huma Israr
Department Of Information Engineering Technology
National Skills University, Islamabad.
[email protected]
Fall 2023, BS-CS
Course Distribution
2+2 Cr Hrs.
2 Lectures , 6 Practical's

Theory Lab
3

Class Schedule

Lecture Hours (Theory)


Tuesday (08:00 to 09:00)
Wednesday ( 11:00 to 01:00)

Semester Calendar
4

Class Schedule

Lab Hours (Practice)

Monday (11:00 to 1:00)


5

Recommended Book

 “ The C++ Programming Language” by Bjarne Stroustrup.

 “ Object-Oriented Programming In C++ ” by Robert Lafore

 “ The Complete Reference C++” by Herbert Shield.


6

“ Web is the Greenest Book”

Recommended Book

 “ C++ How to Program” by Dietel & Dietel .

 “ Programming With C++” by Hubbard J R .

 “ Programming With C++” by C M Aslam , T A Qureshi.


Course Outline:
 Introduction to C and C++
 History of C and C++,
 Overview of Programming Languages
 Compiling and Executing Simple Programs in C++.
 Using main() function,
 Definitions,

 Data Types, Variables, Constants, Operators


 Declaring, Defining and Initializing Variables,
 Scope of Variables,
 Using Named Constants, Keywords, Data Types,
 Casting of Data Types,
 Operators (Arithmetic, Logical and Bitwise),
Course Outline:
 Basic I/O
 Using Comments in programs,
 Character I/O (getc, getchar, putc, putcharetc),
 Formatted and Console I/O (printf(), scanf(), cin, cout),
 Using Basic Header Files (stdio.h, iostream.h, conio.hetc).

 Expressions, Conditional Statements and Iterative Statements


 Simple Expressions in C++ (Unary & Binary Operator Expressions),
 Understanding Operators Precedence in Expressions,
 Conditional Statements (if construct, switch-case construct),
 Understanding syntax and utility of Iterative Statements (while, do-while, and
for loops),
 Use of break and continue in Loops,
 Using Nested Statements (Conditional as well as Iterative)
Course Outline:
 Functions and Arrays
 Utility of functions, Call by Value, Call by Reference,
 Functions returning value, Void functions, Inline Functions,
 Return data type of functions, Functions parameters,
 Differentiating between Declaration and Definition of Functions,
 Command Line Arguments/Parameters in Functions,
 Functions with variable number of Arguments.
 Creating and Using One Dimensional Arrays ( Declaring and Defining an Array,
Initializing an Array,
 Accessing individual elements in an Array,
 Manipulating array elements using loops),
 Use Various types of arrays (integer, float and character arrays / Strings)
Course Outline:
 Multi Dimensional Arrays
 Two-dimensional Arrays (Declaring, Defining and Initializing Two Dimensional
Array, Working with Rows and Columns),
 Introduction to Multi-dimensional arrays.

 File I/O, Preprocessor Directives


 Opening and closing a file (use of fstream header file, ifstream, ofstream and
fstream classes),
 Reading and writing Text Files, Using put(), get(), read() and write() functions,
Random access in files,
 Understanding the Preprocessor Directives (#include, #define, #error, #if,
#else, #elif, #endif, #ifdef, #ifndef and #undef), Macros
Language:
 The system of words or signs that people use to express
thoughts and feelings to each other.
 A set of symbols and rules used to convey information.
 A language is a system of communication which consists of a
set of sounds and written symbols which are used by the
people of a particular country or region for talking or
writing. (e.g. English Language, Urdu Language).
 A system of communication by speaking, writing, or making
signs in a way that can be understood.
( To communicate with the computers, we need some languages. These
are computer languages )
Language Barrier
Language for communication

Talking to Machine
What are Computer Programming Languages?
 Computer programming languages allow us to give instructions
to a computer in a language the computer understands.
 Just as many human-based languages exist, there are an array of
computer programming languages that programmers can use to
communicate with a computer.
 There are mainly three different languages with the help of
which we can communicate with computers. And they are –
 Machine Level language
 Assembly Level Language and
 High Level Language
A Computer language includes various languages that are used to
communicate with a Computer machine. Some of the languages like
programming language which is a set of codes or instructions used for
communicating the machine.

Task: Add two Numbers


2+3=
0010010111 mov ax, 2 A=2
0011101100 mov bx,3 B=3
0100001000 Add ax,bx C=A+B
1111101111 end Return C
Low Level Language:
 Low Level language aka Machine language was the first in the
evolution of computer programming languages.
 Computer directly understands a program written in the
machine language. (No need of a translator to translate the code)
 Low level languages are the machine codes in which the
instructions are given in 0 and 1 (binary digits) form.
 It is mainly designed to operate and handle all the hardware
and instructions set architecture of a Computer.
 The main function of the Low level language is to operate,
manage and manipulate the hardware and system components.
Low Level Languages:
 The main advantage of using Machine language is that
there is no need of a translator or interpreter to translate
the code, as the Computer directly can understand.
 The main disadvantage is you have to remember the
operation codes, memory address every time you write a
program and also hard to find errors in a written program.
It is a machine dependent and can be used by a single type
of Computer.
Assembly Level Language:
 Assembly Language is the second generation programming
language that has almost similar structure and set of
commands as Machine language.
 Assembly language uses mnemonics or symbolic instructions
in place of a sequence of 0s and 1s.
 Because a Computer only understands machine code
languages that’s why we need an Translator that can convert
the Assembly level language to Machine language.
 The main disadvantage of this language is that it is written
only for a single type of CPU and does not run on any other
CPU.
High Level Language:
 Third generation language.
 High-level languages are like English-like language, with less
words also known as keywords and fewer ambiguities.
 Each high level language will have its own syntax and
keywords.
 Require a translator that can convert the high level
language to machine language.
 There is various high level programming languages like C,
FORTRAN, Pascal, BASIC, C, C++, PASCAL, LISP, Ada, Algol,
Prolog and Java and Python.
Compiler:
 A Compiler is a special program that translate statements
written in a particular programming language to another
programming language or "code“.
 A System Software written by a developer to translate (Convert,
Compile) high-level language instruction into a lower-level
language Instruction.
 Compiler convert source code into target code.
 Some compilers translate high-level language into an
intermediate assembly language, which is then translated
(assembled) into machine code by an assembly program or
assembler. Other compilers generate machine language directly.
Source Code Compiler Target Code
High Level Machine Level

Errors

Source Code Assembler Target Code


Mid Level Machine Level

Source Code Interpreter Object Code


High Level Machine Level

High Level Language Compiler Mid Level Language


High Level Assembly

Machine Level Language Assembler


Assembly
Programming Environment:
Program is created in the
A typical Programming Editor Disk editor and stored on disk.
Preprocessor program
Environment consist of 6 Preprocessor Disk processes the code.
Compiler creates
Components. Compiler Disk object code and stores
it on disk.
 Editor Linker Disk Linker links the object
code with the libraries
 Preprocessor Primary Memory
Loader
 Compilers Loader puts program
in memory.
 Linkers Disk ..
..
..

 Loaders Primary Memory


CPU takes each
CPU instruction and
 Execute executes it, possibly
storing new data
..
.. values as the program
..
executes.
High Level Languages
IDE:

You might also like