Outline History What is C++ How does C++ relate to other OO languages Types of applications for...

17
Outline History What is C++ How does C++ relate to other OO languages Types of applications for C++ Components of MS’s Visual C++ 6.0 Advantages / Disadvantages of C++

Transcript of Outline History What is C++ How does C++ relate to other OO languages Types of applications for...

Page 1: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Outline

HistoryWhat is C++ How does C++ relate to other OO

languagesTypes of applications for C++Components of MS’s Visual C++ 6.0Advantages / Disadvantages of C++

Page 2: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

History of C++

1972: C language developed at Bell LabsDennis Ritchie wrote C for Unix OSNeeded C for work with Unix

late 70s: C becomes popular for OS development by many vendorsMany variants of the language developedANSI standard C in 1987-89

Page 3: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

History of C++ (continued)

early 80s: Bjarne Stroustrup adds OO features to C creating C++

90s: continued evolution of the language and its applicationspreferred language for OS and low level

programmingpopular language for application

developmentlow level control and high level power

Page 4: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Conceptually what is C++

Alternatives:is it C, with lots more options and features?is it an OO programming language with C as its

core?is it a development environment?

On most systems it is a development environment, language, and library, used for both procedural and object oriented programming, that can be customized and extended as desired

Page 5: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Versions of C++

ANSI C++Microsoft C++ (MS Visual C++ 6.0)Other vendors: Borland, Symantec, Turbo,

…Many older versions (almost annual)

including different version of C tooMany vendor specific versionsMany platform specific versions

Page 6: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

What you can do with C++Apps (standalone, Web apps, components)

Active desktop (Dynamic HTML, incl Web)Create new controlsCreate apps with "look and feel" of IE4ActiveX documents (charts, graphs, etc.)Data access (e-mail, files, etc)Integrate components w/ other languages

Page 7: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Microsoft’s C++Development Environment

project mgmt, editor, debugging tools, user interface Visual Studio 6.0

Language (compiler, linker, loader, etc.Visual C++ 6.0

Librariesstd libraries, iostream, iomanip, stdio, time,

string, math, etc.

Page 8: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Disadvantages of C++

Tends to be one of the less portable languagesComplicated!!!

40 operators, intricate precedence, pointers, etc.can control everythingmany exceptions and special casestremendous libraries both standard, vendor specific,

and available for purchase, but all are intricate

Aspects above can result in high cost, maintenance and reliability problems

Page 9: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Advantages of C++Available on most machinesCan get good performanceCan get small sizeCan manage memory effectivelyCan control everythingGood supply of programmersSuitable for almost any type of program

(from systems programs to applications)

Page 10: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Structure of a program

// my first program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }

Page 11: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

// my first program in C++

This is a comment line#include <iostream> Lines beginning with a hash sign (#) are

directives for the preprocessorThey are not regular code lines with expressions but indications for the compiler's preprocessor. In this case the directive #include <iostream> tells the preprocessor to include the iostream standard file. This specific file (iostream) includes the declarations of the basic standard input-output library in C++,

Page 12: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

// my first program in C++

This is a comment line

// my first program in C++

This is a comment line

using namespace std; All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std.

Page 13: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

C++ program lec1

To begin learning C++ lets examine our first C++ program:

#include<iostream.h>void main(){cout <<“wellcome to c++ program”;}

Page 14: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

#include<iostream.h>All C++ programs must start with

#include .The iostream.h header file must be

includeFor any program that outputs data to theScreen or inputs data from the keyboard.We shall discuss other types of header

files later in the coming chapter.

Page 15: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

Main() Every C++ program has function called

main{ start of main.} end of main.You should write your program inside main.cout<< It’s passes the characters between

quotes(“)To the screen.

Page 16: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

C++ provide escapes sequence for several usages. these escape are listed below:

\n new line.\t horizontal tab [six space].\a alert sound.\\ print a backslash character.\” print a (“) character.

Page 17: Outline  History  What is C++  How does C++ relate to other OO languages  Types of applications for C++  Components of MS’s Visual C++ 6.0  Advantages.

// مالحظات اكتب انني معناها كتابة

من اوامر لغة سي ++ (المعالج المبدئي) #include

ملف او هدير فايل لتعريف االوامر المستخدمة iostream.h

اقواس لوضع الملف المطلوب ضمه او تحميله بينهما <>