1 chapter-01 introduction to c++ programming language
Post on 01-Jan-2016
213 Views
Preview:
TRANSCRIPT
1
Chapter-01
Introduction to C++ Programming Language
2
C++ History
• 1972 : Dennis Ritchie at Bell Labs designs C and 90% of UNIX is then written in C
• Late 70’s : OOP becomes popular
• Bjarne Stroustrup at Bell Labs adds features to C to form “C with Classes”
• 1983 : Name C++ first used
• 1998 : ISO/ANSI standardization of C++
3
Three C++ Program Stages
other code from libraries,
etc.
other code from libraries,
etc.
written in machine language
written in machine language
written in machine language
written in machine language
written in C++
written in C++
via compiler via linker
SOURCE OBJECT EXECUTABLE
myprog.cpp myprog.obj myprog.exe
4
Translating a source file into an executable file
Source Code is entered with a text editor by the programmer.
Source Code
Preprocessor
Modified Source Code
Compiler
Object Code
Linker
Executable Code
#include <iostream.h>void main(void){
cout<<“Hello World”;}
Object Code for other functions
5
Running a Program
Output
Program Data
Computer
6
C++ Program Translation
• Compile
• Execute
C++ Program Data for C++ Program
C++ Compiler
Machine-LanguageInstructions
Computer Executionof Machine-Language Instructions
Output of C++ Program
C++ Program Data for C++ Program
C++ Compiler
Machine-LanguageInstructions
Computer Executionof Machine-Language Instructions
Output of C++ Program
Computer
Linker
Previously Compiled Helper Programs
C++ Program Translation Including Linker
8
Java Programming Language
• achieves portability by using both a compiler and an interpreter
• first, a Java compiler translates a Java program into an intermediate bytecode--not machine language
• then, an interpreter program called the Java Virtual Machine (JVM) translates a single instruction in the bytecode program to machine language and immediately
runs it, one at a time
9
Java Program Translation
• Both Compilation and Interpretation
• Intermediate Code:“Byte Code”
– portable low-level code
– similar to assembly code,but hardware independent
– invisible to Java programmer
• Interpreter translates from generic byte code to hardware-specific machine code
Java Program Data for Java Program
Java Compiler
Byte-CodeProgram
Byte-Code Interpreter
Machine-LanguageInstructions
Computer Executionof Machine-Language Instructions
Output of Java Program
JavaVirtual
Machine
Java Program Data for Java Program
Java Compiler
Byte-CodeProgram
Byte-Code Interpreter
Machine-LanguageInstructions
Computer Executionof Machine-Language Instructions
Output of Java Program
JavaVirtual
Machine
Linker
Previously Compiled Helper Programs
Java Program Translation Including Linker
11
Learning C++
• There are two pieces to learning the C++ world.
– First, is learning the C++ language itself.
– Second, is learning how to use the classes and functions in the C++ standard library.
12
Procedural and Object-Oriented Programming• Procedural programming and object-
oriented programming are two ways of thinking about software development and program design.
top related