Why use C++?

INTRODUCTION

o Why use C++?
ANSI standard
Compilers available on every platform
All libraries (to my knowledge) have C and/or C++ API

o Is C++ better than Fortran?
Structure
Object orientation
Reusable code and library creation
Excellent error checking at compile time
Fortran becomes more like C++ with every release

o Microsoft Visual C++
Development environment
Create console (DOS) applications
Can develop full-blown Windows applications

INCLUDING HEADER FILES AND LIBERARY FUNCTIONS

C++ programs try to be ‘lean and mean’;
programmer chooses what to include in the executable
Header files declare the functions to be linked in from libraries…
#include <iostream.h> —————>read & write functions
#include <
math.h>——————->sqrt, log, sin, abs, etc
#include “D:\andy.h” ———————>
My stuff that I use frequently and don’t want to recreate

MICROSOFT VISUAL C++

Each program is created within a ‘project’
A project can only contain ONE ‘main’ function
Basically each individual project is a program
Each project is stored in a folder
To open a project, double-click the ‘.dsw’ file in the folder
Click Help>Index and type a query – massive documentation
Or select (highlight) a keyword and press F1 on keyboard

Example programs and VC++

Get VC++ installation disks from Alan (sign license for Mr Gates)
Projects can be downloaded – they are zipped (PowerZip/WinZip)
You might need to go to Project>Settings and click Debug tab and set your own path to where the project is stored (I suggest M:\C++\ as the folder to unzip the examples into)
Experiment with the examples – compilation errors appear in the window below the source window(s)… double-click on the error message to go to the line containing the error.
You can highlight a keyword (or whatever) and press F1 to get help
The documentation is huge – and not just about VC++; be selective!

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *