Copying a Pascal Program into Lazarus
Start Lazarus by double-clicking on its Launch icon , or by using the Start button.
After Lazarus has started, you will see the following menu bar:
On the menu bar click on Project.
'Project' is circled in purple in the graphic above.
A drop-down menu will appear:
On the drop-down menu, click on New Project ....
The Create a new project dialogue appears:
Click on Program in the list of options, as shown above, and then click on the OK button.
You may see the following Project changed dialogue:
If do see the above Project changed dialogue, just click on the No button.
(It was a brand new project and so nothing valuable will be lost).If you do not see the above dialogue you do not need to do anything in this step.
You should now be able to see a new project in the Source Editor
- In your browser, navigate to the page containing the Pascal program you want to copy.
Copy the code into the clipboard by selecting it then pressing CTRL+C, as follows:
- Use the mouse to position the cursor before the 'p' of 'program' in the first line
- Drag the cursor with the left mouse button down until the cursor is positioned just after the final full stop after 'end.'
- Press CTRL+C
- In Lazarus, select all the text in the editor.
- Press CTRL+V to replace all of this text with the copied Pascal code.
- Carefully check that all the Pascal code is now in the Lazarus editor. Check that there are neither extra, nor missing characters at the beginning and end.
- Save the file by selecting menu item
- Navigate to a suitably named new folder and save the file with the name given in the first line of the program.
The program is now available for you to edit and run. Remember that student programs may require some adjustment before they will compile and run successfully. (We have tested all of them, but sometimes changes to compilers necessitate minor alterations to the original code).
Experiment with the program. See what improvements you can make.
If you want to, you can quit from Lazarus by selecting menu item