Académique Documents
Professionnel Documents
Culture Documents
STRUCTURES II
CS6301
Introduction
What is C++
History of C++
Bjarne Stroustrup
The creator of C++ language and its
first implementation.
Born in Aarhus Denmark, 1950.
Cand.Scient. (Math. and C.S.), 1975,
University of Aarhus, Denmark.
Ph.D. (Computer Science), 1979,
Cambridge University, England
The head of AT&T Lab's Large-scale
Programming Research department,
an AT&T(American Telephone and
Telegraph Company) Bell Laboratories
Fellow, an AT&T Fellow and ACM
Fellow.
Recipient of the 1993 ACM Grace Murray
Hopper award.
History of C++
Fortran
Lisp
Algol60
1960
1960
CPL
PL/I
BCPL
Simula 67
Pascal
1970
1970
ML
Algol 68
Modula-2
1980
Ada
Clu
C with Classes
Beta
C++
ANSI C
Smalltalk-80
1980
Objective C
Eiffel
CLOS
1990
C++arm
Modula-3
Ada9X
C++std
1990
History of C++
C++ Timeline
1979 May Work on C with Classes starts
Oct
1980 Apr
1982 Jan
C++ named
1984 Jan
1985 Feb
Oct
Oct
History of C++
C++ Timeline
1987 Feb Cfront Release 1.2
Nov 1st USENIX C++ conference (Santa Fe, NM)
Dec 1st GNU C++ release (1.13)
1988 Jan
History of C++
C++ Timeline
1991 June The C+ + Programming Language (second edition) [2nd]
June 1st ISO WG21 meeting (Land, Sweden)
Designing the
main module(i.e main
function)
Then decide what all other
modules to be include and
then we will design all
other sub modules
Eg:- c
Bottom up approach
Preprocessor
Compiler
Linker
Disk
Program is created in
the editor and stored
on disk.
Disk
Preprocessor program
processes the code.
Disk
Compiler creates
object code and stores
it on disk.
Disk
Primary
Memory
Loader
Disk
Primary
Memory
CPU
..
..
..
Visual C++
Using menu choices and buttons
#include <iostream>
In C++, a stream is a sequence of characters associated with an
input device, or an output device, or a disk file.
Class iostream defines object cin as the stream associated
with input device (keyboard).
Class iostream defines object cout as the stream
associated with output device (screen).
Class iostream also defines:
input operator >> (extract from input stream);
output operator << (insert to output stream).
Header Files
list of header files.doc
#include <iostream.h>
int main()
{
std::cout<<"Hello, world!\n";
}
Namespaces.doc
#include <iostream.h>
using namespace std;
int main()
{
cout<<"Hello, world!\n";
}
Main function
Braces enclose
the body of the
function
They represent
the start and end
of the function
Declarations and
statements
Main body of
function (or main
part)
// represents the
start of a
comment
int main()
{
// Declarations
// Statements
return 0;
}
Return statement
specifies the
value the function
returns
All (almost)
declarations and
statements end
with a semi-colon
;
This
program
doesnt do
anything!
Sample 1
#include <iostream.h>
void main()
{
int number;
cout << Enter a number <<
endl;
cin >> number;
cout << You entered: <<
number << endl;
}
Variable
declaration
The identifier
number is
declared as being
of data type int,
or integer
Sample 1
#include <iostream.h>
void main()
{
int number;
cout << Enter a number <<
endl;
cin >> number;
cout << You entered: <<
number << endl;
}
cout
the output
statement for C++
Note the direction
of <<
endl represents
an end-of-line
Sample 1
#include <iostream.h>
void main()
{
int number;
cout << Enter a number <<
endl;
cin >> number;
cout << You entered: <<
number << endl;
}
cin
the input
statement
for C++
Note the
direction of
>>
Sample 1
#include <iostream.h>
void main()
{
int number;
cout << Enter a number <<
endl;
cin >> number;
cout << You entered: <<
number << endl;
}