Borland C++ General Introduction

Math 10 -- D. C. Smolarski, S.J.
Santa Clara University, Department of Mathematics and Computer Science

[Return to Math 10 Homepage]

Contents


General Overview

One popular C++ compiler for PCs is made by Borland (also known for its special version of Pascal for PCs, called Turbo-Pascal). Borland C++ is available for use in the Kenna, Orradre, and O'Connor labs and can be found by clicking on the folder "PROGRAMMING LANGUAGES" or "PROGRAMMING RESOURCES."

The Orradre and Kenna labs have version 5.0 installed, the O'Connor lab has version 4.5 installed. Some people may still be using a DOS version 3.0. All versions are compatible with with each other with some minor differences in locating the commands. NOTE: In Kenna and Orradre, you will get error messages while starting up Borland C++. Ignore these messages which are caused because the hard drive on the server is protected against storing new files. You will also get error messages if you try to run a program in a file not stored on a diskette.

Borland C++ works in an integrated environment (like many word processing programs), in which the environment includes its own editor and the top task menu bar includes options through which the user compiles the code and then runs the program.

Creating a Program File

To create a program file, one clicks on the PROGRAMMING LANGUAGUES (PROGRAMMING RESOURCES) folder and then clicks on BORLAND C++.

One then clicks on the FILE option (left-most option on top menu bar), and clicks on NEW to create a new file (use the TEXT EDIT option) or OPEN to edit an existing file. If the file is to be stored on a diskette, one must indicate the drive name, e.g., a:prog3.cpp.

To SAVE a written file, one clicks on the SAVE AS option given under the FILE menu option. NOTE: The convention used by Borland C++ is that the file extension for program files should be cpp.

Compiling a Program

To compile a program using Borland C++ version 4.5 or 5.0, one goes to the PROJECT option on the menu bar and then clicks on COMPILE. Using version 3.0, there is a separate COMPILE option on the menu bar.

Alternatively, one can press <alt> F9 to compile in any version.

If there are errors, they will be noted in a separate window. If there are no errors, a window will tell you of this fact.

Running a Program

To run a program using version 5.0 or 4.5, click on the DEBUG option on the top menu bar and then click on the RUN option. Using version 3.0, there is a separate RUN option on the top menu bar.

Alternatively, one can press <ctrl> F9 to compile in any version.

If there are run-time errors, you will get an error window.

Output Screen

In version 3.0, if you write to the screen, the output screen may disappear before you get to see it! To go back to the output screen, press <alt> F5.

In version 4.5 or 5.0, if a program writes to the screen (using a cout statement), the output window may NOT remain open. A common practice to force the screen to remain open is to include the statement

     cin.get();
or
     cin >> i;
(where i is declared as a character variable) immediately before the return 0; statement at the end of main. This will cause the output window to open and remain open until some key is pressed.
[Return to Math 10 Homepage ]

This page is maintained by Dennis C. Smolarski, S.J. dsmolarski@math.scu.edu
© Copyright 1998, 1999 Dennis C. Smolarski, SJ, All rights reserved.
Last changed: 5 October 1999.