C++ Lect 2
C++ Lect 2
History of C
Evolved from two other programming languages
BCPL and B
“Typeless” languages
Ms Qurat-ul-Ann
History of C and C++
History of C++
Extension of C
Early 1980s: Bjarne Stroustrup (Bell Laboratories)
“Spruces up” C
Provides capabilities for object-oriented programming
Objects: reusable software components
Model items in real world
Object-oriented programs
Easy to understand, correct and modify
Hybrid language
C-like style
Object-oriented style
Both
Ms Qurat-ul-Ann
C++ Standard Library
C++ programs
Built from pieces called classes and functions
C++ standard library
Rich collections of existing classes and functions
“Building block approach” to creating programs
“Software reuse”
Ms Qurat-ul-Ann
Java
Java
1991: Sun Microsystems
Green project
1995: Sun Microsystems
Formally announced Java at trade show
Web pages with dynamic and interactive content
Develop large-scale enterprise applications
Enhance functionality of web servers
Provide applications for consumer devices
Cell phones, pagers, personal digital assistants, …
Ms Qurat-ul-Ann
Visual Basic, Visual C++ and C#
BASIC
Beginner’s All-Purpose Symbolic Instruction Code
Mid-1960s: Prof. John Kemeny and Thomas Kurtz (Dartmouth
College)
Visual Basic
1991
Result of Microsoft Windows graphical user interface (GUI)
Developed late 1980s, early 1990s
Powerful features
GUI, event handling, access to Win32 API, object-oriented
programming, error handling
Visual Basic .NET
Ms Qurat-ul-Ann
Visual C++
Microsoft’s implementation of C++
Includes extensions
Microsoft Foundation Classes (MFC)
Common library
GUI, graphics, networking, multithreading, …
.NET platform
Web-based applications
Distributed to great variety of devices
Cell phones, desktop computers
Ms Qurat-ul-Ann
Other High-level Languages
FORTRAN
FORmula TRANslator
1954-1957: IBM
Complex mathematical computations
Scientific and engineering applications
COBOL
COmmon Business Oriented Language
1959: computer manufacturers, government and industrial
computer users
Precise and efficient manipulation of large amounts of data
Commercial applications
Ms Qurat-ul-Ann
Other High-level Languages
Pascal
Prof. Niklaus Wirth
Academic use
Ms Qurat-ul-Ann
Structured Programming
Structured programming (1960s)
Disciplined approach to writing programs
Clear, easy to test and debug, and easy to modify
Pascal
1971: Niklaus Wirth
Ada
1970s - early 1980s: US Department of Defense (DoD)
Multitasking
Programmer can specify many activities to run in parallel
Ms Qurat-ul-Ann
The Key Software Trend: Object Technology
Objects
Reusable software components that model real world items
Meaningful software units
Date objects, time objects, paycheck objects, invoice objects, audio
objects, video objects, file objects, record objects, etc.
Any noun can be represented as an object
Ms Qurat-ul-Ann
Basics of a Typical C++ Environment
C++ systems
Program-development environment
Language
C++ Standard Library
Ms Qurat-ul-Ann
Writing C++ Programs
The source code of a C++ program is stored on the disk with the file
extension cpp. (.cpp stands for c plus plus).
The program is stored in a text file on the disk. Any text Editor can be
used to write and edit C++ source code.
The Borland C++ and Turbo C++ have their own editors for writing the
source code. The source code is written in the editor and then it is
complied.
The C++ complier translates a C++ source program into machine code.
The machine code is called object code. It is stored in a new file with
extension obj.
Ms Qurat-ul-Ann
Writing C++ Programs cont..
The object code is then linked to the libraries. After linking the
object code to the libraries, an executable file with the extension .exe
is created.
Ms Qurat-ul-Ann
Structure of C++ Programs
C++ consist of three main parts:
Preprocessor directives
C++ Statement
Ms Qurat-ul-Ann