Sie sind auf Seite 1von 3

Hands-On Instructions for Turbo C

Note: The enter key is represented by .


Open Turbo C using MS-DOS Prompt

Click START  PROGRAMS  MSDOS Prompt

C:\Windows> cd\ 
This will change the directory back to the main/root drive which is C:
C:\> cd turboc 
This will open the folder turboC
C:\TurboC> cd bin 
This will open the folder BIN from folder turboC
C:\TurboC\bin> dir/w 
This will display the list of files inside the folder BIN. Look for TC.exe to open it later.
C:\TurboC\bin> TC 
This will open the editor window of Turbo C where you can type your program/code.
The C++ IDE will appear. Now, you are ready to create programs in Turbo C.
Change the directory and locate your folder by pressing ALT+F and choose Change Directory.
Read through the following sections. Do the examples at the end of each section Look back at a previous
sections for help. Read the screen. Any time it says press any key, press a key (like the spacebar) after
reading the screen.
A. Entering your program
The enter key is represented by . Type the following example.
/* Sample Program */

#include <stdio.h>

#include <conio.h>

void main()

{

int sum;

printf("START\n");

sum = 3 + 7;

printf("THE SUM IS %d \n" , sum); 
printf("DONE\n");

getch();

}

If you make a mistake backspace to erase it, and retype the characters
B. Saving program
To save a file,

press Alt+F (for file menu)


type S (to save)
If the file has not been saved before, type the filename and press enter. If the file has been save before
then it will be saved under the old name.
Save the program you have just written in part A as SAMPLE Notice there are no spaces in the filename.
Note: To save under new name use the Save As option.
FILENAMES can consist of a drive letter (A: for left/top/only drive) followed by a colon then the
filename (consisting of a name 8 characters or less beginning with a letter) and an extension (.CPP) Note:
If you want to change the name of the file later, use option A (Save As) on the file menu. This allows you
to save the file with a new name.
C. Executing the program
Executing your program takes 2 steps compiling and running the program.
Step 1: To compile your program,
press Alt+C (to get the compile menu)
type C (to compile program)
Note: A shorter way to execute a program is Alt+F9
Step 2: To run your program,
press Alt+R (to get to the run menu)
type R (to run the compiled program)
Note: A shorter way to execute a program is Ctrl+F9
If you need to stop execution of a program, press the Crtl +Break keys.
To look at the output again
press Alt+W (for Window menu)
type U (for user screen)
Another way to see the output is Alt +F5. Once in the output screen, press any key to get back to the
editor.
Note: To print the output screen, press the Print Screen key.
D. Making corrections to your program
1. typing over characters
To type over character, first get out of the insert mode by pressing INSERT key, then position
cursor and type over characters. Notice the cursor is now a blinking block.
change all 3's to 8's and change all 7's to 9's in line sum = 3 + 7;
to be
sum = 8 + 9;
2. inserting characters
To insert characters, first get into insert mode (by pressing the INSERT key) and positioning
cursor and then type the characters in. You will notice the cursor is now a blinking line.
Note: Do not position using the enter key, else you will get new lines.
insert the phrase 'WE ARE ' in line
printf("DONE\n");
to be
printf("WE ARE DONE\n");
3. deleting characters
To delete characters, position cursor to characters to be deleted and
press the DELETE key.
delete the characters 'THE' in line

printf("THE SUM IS %d\n",sum);


to be
printf("SUM IS %d\n", sum);
4. inserting lines
To insert lines, position cursor to where you want the new line to go before and at the beginning of
that line press enter; or position cursor to the end of line you want it to go after and press the enter
key.
insert the following line before the first printf.
clrscr();
5. deleting lines
To delete lines, position cursor to line to be delete and press CTRL+Y
delete the following line
printf("START\n");
Note: Please save these changes before going to the next section.
E. Close Window
To close current window,
type Alt W (for window menu)
press C (to close current window)
Note: The Close All option is used to close all open windows. This does not exit Turbo C.
F. Clear Workspace for new program
To clear the workspace for a new program,
type Alt F (for file menu)
press N (for new)
Before it clears the workspace, you will be prompted to save the file if it has not been saved with the
new changes. [Use the tab key to move to correct response then press enter.]
G. Load/Open old program
To load a previously created program,
type Alt F (for file menu)
type O (to open a program)
It will ask you for a filename. Type SAMPLE and press enter.
H. Use DOS Commands
To clear user screen with DOS command,
press Alt F (for file menu)
type D for (DOS prompt)
at A> prompt
type CLS <- (or any DOS command)
to return to Turbo C type EXIT <Note: You can delete files by typing ERASE filename.ext at a> prompt.
I. Exiting Turbo C
To exit Turbo C,
type Alt F (for file menu)
press Q (to quit Turbo C)
If the file hasn't been saved, it will prompt you to save the file before exiting Turbo C.

Das könnte Ihnen auch gefallen