"."/> ".">
Home >Common Problem >How to install Pascal
Editing, saving and debugging PASCAL programming
1. Please confirm the disk directory where the Turbo.exe file is located. If it is placed in the TP7 folder (also known as a subdirectory) on the F: drive.
2. Set the disk where you want to save the program file as the current disk, and save the file in the current directory of the current disk. If your program files are to be stored in the current directory of the H: drive, enter the following command after the DOS prompt ">".
>h:←┘
3. Call and execute Turbo.exe to enter the Turbo Pascal integrated environment.
>f:\tp7\turbo.exe←┘
4. In the program editing window, enter the example 1-1 program. Note that an editing window can only edit one program file. Commonly used editing keys are:
←↑→↓: cursor movement keys.
Delete: Delete the character where the cursor is.
←┘: Enter key, used to wrap a line or insert a line at the cursor.
5. After editing the program, press the F10 key, execute the [Save] item menu in the main menu [File] to save the program to the disk, and use "yz1-1.PAS" as the example 1-1 program Save file name.
Run the program, observe the running results, and track the debugger
1. Press the F10 key, execute the [Run] item menu in the main menu [RUN], run the program, and then enter after the prompt A radius value for debugging:
#r= 10←┘
2. Press the F10 key, execute the [output] item menu in the main menu [Debug], open the output window and observe the results As follows:
R= 10.00 L= 62.80 S= 314.00
If there is an error, please find the error and modify it, repeat step 1, and execute again until the result is output.
3. Repeat step 1, run the program again, enter another radius value of 5, and observe whether the output result is also correct to confirm the correctness of the program.
Commonly used operations in program debugging include:
The window with a double-line frame is called the "current active window".
F1 key: Get help information for the item at the cursor position.
F4 key: Run to the cursor and pause.
F5 key: Zoom in or out of the currently active window.
F6 key: Switch other windows to the currently active window.
F7 key: Trace the program into a subroutine.
F8 key: Step through the program to complete the subroutine call.
F10 key: Switch between menus and active windows.
CTRL Break key: Forcefully terminate program execution.
For other function buttons, please refer to the English help instructions to master them later.
(In addition to using F10 to activate the menu, you can also use Alt letters to directly activate a menu item. For example: Alt R can directly activate the [Run] menu item. Please try it! Think about it, you can Activate other menu items directly?)
4. Learn the tracking debugging method, which can help us check and analyze errors in the algorithm.
(1) Press the F10 key, execute the [Watch] item menu in the main menu [Debug], and open the monitoring window
(2) Press the Insert key and enter the constant pi←┘
Insert key, enter the variable r←┘
Insert key, enter the variable l←┘
Insert key, enter the variable s←┘
(3) Press Press the F8 key to single-step the program and observe
(4) The value changes of the variables in the Watch monitoring window during program execution to analyze whether the algorithm is correct.
Note: Press the F10 key and execute the [Program Reset] item menu in the main menu [Run] to terminate the single-step execution or trace debugging of the program.
Close the current active window and exit the Turbo Pascal integrated environment
1. Press the F6 key to switch to the current active window and execute the [Close] menu in the main menu [Windows] If the current active window is a program editing window, the user may be asked whether the program in the editing window needs to be saved because the program has been modified before closing. Try closing all windows one by one.
2. Execute the [Exit] menu item in the main menu [File] to exit the Turbo Pascal integrated environment and return to the DOS prompt state.
The above is the detailed content of How to install Pascal. For more information, please follow other related articles on the PHP Chinese website!