Turbo C++ Cheat Sheet
Help Commands:
^F1 Get help on a C keyword.
(place cursor beneath the first letter of the keyword you want help on)
File Commands:
<alt> F D Will take you to a dos prompt
F2 Save current file
<alt> X Quit Turbo C
F3 Open a file
^KR Read one file into another
^KW Write a file from a block of text
To
print your source code, run Notepad and load your CPP file into it, File/Print.
To
print runs of your programs, Use the usual Screen Print or copy and paste
Techniques.
Line Commands:
^Y Delete a line
Home Jump Cursor to beginning of line
End Jump Cursor to end of line
^PgUp Jump Cursor to top of file
^PgDn Jump Cursor to bottom of file
Screen Commands:
<Alt>F5 Switch from Edit Screen to See test results, or return
Watch Commands:
^F7 Set Watch Variable
(place cursor beneath the first letter of the variable you wish to Watch)
Lab: Introduction to the Turbo C++ Programming Environment
(original by Lloyd Vaught)
Objectives:
The student will master the following skills:
Task 1 - How to enter the Turbo C programming environment.
Task 2 - How to move among the menus.
Task 3 - How to change the current directory.
Task 4 - How to create and save a new editor file.
Task 5 - How to load, modify and save an existing file.
Task 6 - How to print an editor file.
Task 7 - How to exit the Turbo C environment.
Task 8 - How to set the Output Directory for .obj and .exe files.
Task 9 - How to Compile and edit syntax errors.
Task 10 - Linking and Running your program all at once.
Task 11 - How to Test an executable program in DOS.
Task 12 - How to Output hardcopy results of running a C++ program.
Keywords
--------
menu(s) hot keys windows messages
Esc F1-help F2-save F3-load
F5-zoom F10-menu File Edit
Run Compile Project Options
Debug Break/Watch commands toggles
settings
Key Concepts
------------
The Turbo C++ integrated development environment is much more than just
a fast C++ compiler; it is a fast, efficient C++ compiler with a built-in
editor, debugger, and other utilities that are easy to learn and easy
to use. With Turbo C++, you don't need to use a separate editor, debug-
ger, compiler, linker, and Make utility in order to create and run your
C++ programs. All these features are built right into Turbo C++, and they
are all accessible from one clear and simple display - the main menu
screen.
A complete description of the Turbo C++ integrated development environ-
ment can be found in Chapter 5 of the Turbo C++ User's Guide. In this
laboratory exercise we will just introduce you to enough information
to enable you to use this environment to create new text/source files,
save a file, load an existing file, edit/modify an existing file, and
finally print the file for a "hardcopy" of your work.
Turbo C++ gives you context-sensitive onscreen help at the touch of a
single key. You can get help at any point within any Turbo C++ menu by
simply pressing the F1 key. The Help window explains the functions of
the item on which you are currently positioned. Any help screen may
contain a keyword (a highlighted item) that you can choose to get more
information. Use the arrow keys to move to any keyword and press the
Enter key to get more detailed help on the chosen item. You can use
the Home and End keys to go to the first and last keywords on the screen,
respectively.
There are many more features that you may want to explore by reading
the turbo C++ User's Guide. To exit from the Help system and return to your
menu choice, press the Esc key or any specific hot key action you may
want to invoke.
Let's get started using the editor.
===> Task 1 - How to enter the Turbo C++ programming environment.
1. Click on the start button.
2. Select the program menu option.
3. Find the C++ menu option and click on it. Turbo C++ will be loaded automatically.
===> Task 2 - How to move among the menus.
1. Press the F10 key.
Pressing the F10 key will take you to the main menu line at
the top of the screen. The options are:
File Edit Search Run Compile Debug Project Options Window =============================================================
2. The arrow keys can be used to move left or right to highlight
an option. Press the enter key to select the highlighted
option and view the sub-menu.
For example, position the cursor on File and press enter.
Use the arrow keys to move up and down the sub-menu.
Press the Esc key to exit the sub-menu without making a
selection.
3. Another way to select a menu option is to press the Alt key
and the highlighted first letter for the option simultaneously.
Try pressing Alt C to view the compile sub-menu.
Press the Esc key to exit the sub-menu.
4. Press F10 to return to the main menu and spend a few moments
exploring the various menu options.
Press F1 to see Help screens that provide additional inform-
ation on a highlighted option.
Press the Esc key to exit Help.
===> Task 3 - How to change the current directory.
It is very important that you set the directory for where your files
are stored. This will be on one of your 3.5" diskettes and can be in
either the A: or the B: drive.
1. Press F10 to go to the main menu.
2. Press F to select the File option.
3. Press C to select the Change Dir option. You will be prompted
to enter the directory that contains your files.
4. If your diskette is in drive A - type A: and press Enter,
else if your diskette is in drive B - type B: and press Enter.
5. Press the Esc key to exit the sub-menu.
This will insure that when you issue a save command your work will be
stored properly on your diskette. Also, when you issue a load command
your file will be retrieved from your diskette. Otherwise your work
may be lost forever.
===> Task 4 - How to create and save a new editor file.
1. Press F10 to ensure that you are at the main menu.
2. Press E to select the Edit option. You should see the cursor
blinking in the top left corner of the edit screen.
3. The screen is now yours to type anything that you may want to
type. Please type in the following short program exactly as
you see it.
FOR
CODE SAMPLE SEE HANDOUT!
Introduction to Turbo C++
4. Press F10 to go to the main menu.
5. Press F to select the File option.
6. Press S to select the Save option. Since this is the
first time that this file is being saved to disk you need to
give the file a name.
7. Type HELLO and press the Enter key. A file extension of ".CPP"
will automatically be appended to the file name. You should
see either the A: or B: drive light come on (depending on the
drive you selected in Task 3) as the file is being saved to
your diskette. You have just created and saved your first
C++ program.
8. Press F10 to go to the main menu.
9. Press F to select the File option.
10. Press N to select the New option. You should see the edit
screen go blank. Normally you would not do this at this time,
but for now it is important that you clear memory of the
program you just typed in.
===> Task 5 - How to load, modify and save an existing file.
1. Press F10 to go to the main menu.
2. Press F3 to select the Pick option. Type the name of the
C++ program that you want to load. In this case type HELLO
and press the Enter key. The HELLO.CPP program that you created
and saved in Task 4 will be loaded from your diskette back
into memory and be visible in the edit window ready for
editing or compiling.
3. Using the cursor movement keys, position the cursor on the "y"
of
"your full name" on the NAME line.
Using the
all the letters on that line. (You can also erase characters
on a line of text by using the backspace key)
4. With the cursor positioned between the < > symbols type in
your actual name. The editor is automatically in the insert
mode so the characters of your name will be inserted inside
the < > symbols.
5. Now position the cursor on the information portion of the
PROJECT line, erase the generic information that is already
there and replace it with your own information about this
laboratory project. Try to keep the overall format just as
you see it.
6. Finally, modify the DUE DATE and MODIFIED lines to today's date.
7. Press F2 to save the modified program to your diskette. Note
that this time we only needed to save the file, not name it
and save it as we did in Task 4. Always remember to save your
file any time that you have made any modifications to it.
===> Task 6 - How to print an editor file.
1. Make sure that the printer is on and that the "on line" light
is illuminated.
2. Make sure that the printer switch box is set to your computer.
3. Make sure that your file is visible in the edit window.
<Alt> F to go to the file menu, then P to print
You should see "printing" show up on the upper part of the screen,
and hear the printer start to print your file.
4. When the printing has finished, go to the printer, press the
on-line button to put the printer off line, press the form-
feed button to advance the paper so that you can tear it at
a perforation line, then press the on-line button once again
to put the printer back on line.
===> Task 7 - How to exit the Turbo C++ environment.
1. Make sure to edit the MODIFIED date at the head of your C++
program.
2. Press F2 to save all modifications to your file.
3. Press F10 to go to the main menu.
4. Press F to select the File option.
5. Press Q to select the Quit option. (Alt-X will also Quit.) The Turbo
editor will terminate and return you to Windows 95 Desktop.
===> Task 8 - How to set the Output Directory for .obj and .exe files.
1. Enter the Turbo C++ environment as described in LAB 1.
2. Load your file HELLO.CPP (created by lab 1) from your diskette.
3. Press the F10 key to go to the main menu.
4. Press O to select the Options option.
5. Press D to select the Directories option.
6. Press O to select the Output option and then type either
an A: or a B: . Also change the source directory to A: or B:.
Press the enter key and this will tell the Turbo environment
where your diskette is located. When you compile
and link a C++ program, your object code (.obj) file and your
executable code (.exe) will now automatically be stored on
the specified drive.
7. Finally, press the Esc key twice to go back to the main menu
selection bar.
Please remember to always perform these steps each time you run Turbo C++ from now on!
===> Task 9 - How to Compile and edit syntax errors.
1. Try pressing Alt C to view the compile sub-menu.
2. Press the enter key. This will cause turbo C++ to compile your program (which must be loaded at the time.) If there are no errors, it will say "successful".
3. If there are errors, you must edit your source code and compile again until they are all removed (debugged).
===> Task 10 - Linking and Running your program all at once:
Once you have successfully compiled your program it is time to run it and
test it for semantic errors. (to see if it works right).
1. Press Alt R then press the enter
key
This is a shortcut to do a test run. If your program halts with errors, you must fix them before running the program. If your makes it all the way through and has no errors, then it will execute.
2. After you have entered the data, it will appear to simply vanish and go back to the editing screen. This is because the program printed out the results and quit so quickly that you couldn't read it.
To see the results, press Alt F5
3. To return to editing, press Alt F5 again.
===> Task 11 - How to Test an executable program in DOS.
1. Press Alt F to go to the file menu.
2. Press D to select the Dos Shell option. The Turbo editor will
open a dos shell and allow you to use dos commands.
.
3. Type in the name of your program. HELLO for instance, to run your program from Lab 1.
4. Run and test your program as usual, everything that appears on the screen should also go to the printer.
5. Type the command Exit This will take you back to the editing screen.
6. Quit turbo C++ and hand in your printouts.
===> Task 12 - How to Output hardcopy results of running a C++ program.
Printing Runs
Printing
Runs of your programs can be a challenge.
For your Source code, there is no difficulty, simply use the print
command described above. For runs, it
can be more complex. Three methods are
described here:
1. Use <shift> PrtScrn. This method works fairly well if your program
runs are short. With output that takes up more than a page,
however, things get more difficult.
2. Windows Cut and Paste. If the above methods don’t work, you may
have
to print using the windows
clipboard. To do this, you must run
Turbo C++ in a Window (rather than fullscreen). When you are running in a window, you click
the mouse on the selection button, then sweep the area of text you want to
print. Then hit the copy button. Lastly, open an editor such as notepad and
click paste. The text from your run will
appear. Print the text.
===> Final Task
Quit turbo C++ and hand in your source code and test-run printouts.