hello world pascal tutorial

35
2/27/02 C. Locke Hello World Pascal Tutorial Nova Southeastern University Cristal Berón-Locke

Upload: serghei-urban

Post on 22-May-2015

712 views

Category:

Education


4 download

TRANSCRIPT

Page 1: Hello world pascal tutorial

2/27/02 C. Locke

Hello World

Pascal Tutorial

Nova Southeastern University

Cristal Berón-Locke

Page 2: Hello world pascal tutorial

2/27/02 C. Locke

Obtaining the Software

• Object Pascal is included on the disk that comes with Learn Pascal with Delphi, written by Warren Rachele.

• The book can be purchased for $49.95 from www.barnesandnoble.com.

(ISBN 1-55622-719-1)

Page 3: Hello world pascal tutorial

2/27/02 C. Locke

Before you begin to install, make sure that you exit all windows programs that are

currently running.

Page 4: Hello world pascal tutorial

2/27/02 C. Locke

Installing the Software

1. Place the disk into the CD-Rom drive (in many cases it is the D drive, however this may vary depending on the computer you are using).

2. Sometimes the program will begin the installation process on its own. If this happens, skip steps 3, 4, & 5. Instead, go to step 6.

Page 5: Hello world pascal tutorial

2/27/02 C. Locke

3. Double click on My Computer on your desktop

Page 6: Hello world pascal tutorial

2/27/02 C. Locke

4. Double click on the Object Pascal icon, which should be the same icon as your CD-ROM drive.

Page 7: Hello world pascal tutorial

2/27/02 C. Locke

5. Double click on install.exe.

Page 8: Hello world pascal tutorial

2/27/02 C. Locke

6. A blue screen will appear and on the left side there will be a message telling you to select a product to install.

Page 9: Hello world pascal tutorial

2/27/02 C. Locke

7. Click on the Next button to continue.

Page 10: Hello world pascal tutorial

2/27/02 C. Locke

8. Read the Software License Agreement and click on Yes to continue.

Page 11: Hello world pascal tutorial

2/27/02 C. Locke

9. Click on Next to continue.

Page 12: Hello world pascal tutorial

2/27/02 C. Locke

10. Choose the Typical installation and then click Next.

11. After Object Pascal has been installed, restart your computer.

Page 13: Hello world pascal tutorial

2/27/02 C. Locke

Starting the Program

1. Click on the Start button on the lower left hand side of your screen.

2. Go to Programs, then to Delphi, and finally click on Delphi 5.

Page 14: Hello world pascal tutorial

2/27/02 C. Locke

3. The program will begin and a screen will appear like the one below.

Page 15: Hello world pascal tutorial

2/27/02 C. Locke

Building a Template1. Click on the

x on the upper right hand corner of the Form 1 window.

Page 16: Hello world pascal tutorial

2/27/02 C. Locke

2. Close the Unit1.pas screen by clicking on the x in the upper right hand corner of the window.

3. When asked if you want to save the changes made, click no.

Page 17: Hello world pascal tutorial

2/27/02 C. Locke

4. Select Project from the Delphi 1 window and then View Source.

Page 18: Hello world pascal tutorial

2/27/02 C. Locke

5. A window will appear titled project project1.dpr. Delete all of the text in that window and type the following.

program template;

begin

end.

Page 19: Hello world pascal tutorial

2/27/02 C. Locke

6. Click on File and then Save Project As from the menu at the top of the screen.

Page 20: Hello world pascal tutorial

2/27/02 C. Locke

7. Name the file template and leave the extension as .dpr.

Page 21: Hello world pascal tutorial

2/27/02 C. Locke

8. Click on Project and then Options from the menu.

Page 22: Hello world pascal tutorial

2/27/02 C. Locke

9. Click on the tab called Linker.

10.Click on the square that says Generate console application.

11.Click on OK.

Page 23: Hello world pascal tutorial

2/27/02 C. Locke

12. Click on Project and then Add to Repository from the menu at the top of the screen.

Page 24: Hello world pascal tutorial

2/27/02 C. Locke

13. Type in under Title: Console Application

14. Type under Description: Template for console application

15. Type under Page: Projects

16. Type under Author: Your Name

Page 25: Hello world pascal tutorial

2/27/02 C. Locke

17. Now in order to confirm that all of the steps have been performed successfully, click on File and then Close All from the menu.

18.Select yes to save changes.

Page 26: Hello world pascal tutorial

2/27/02 C. Locke

19. Click on File and then New from the menu to bring up the New Items window.

20. Click on the tab named Projects, click on Console Applications, and then click OK.

21. You are now ready to begin programming!

Page 27: Hello world pascal tutorial

2/27/02 C. Locke

Hello World Program

1. Type the following into your template window:

program helloworld;

begin

writeln (‘Hello World!’);

writeln (‘This is my first Pascal program.’);

readln;

end.

Page 28: Hello world pascal tutorial

2/27/02 C. Locke

2. Click on Run and then Run from the menu at the top of the screen.

Page 29: Hello world pascal tutorial

2/27/02 C. Locke

3. Your first program will run on a DOS based screen.

4. In order to exit the program, hit any key.

Page 30: Hello world pascal tutorial

2/27/02 C. Locke

Saving Your Program

After all of that work, I have to assume you want to save your work of art!

Saving your work is important so that you will not have to start over when you

return.

Page 31: Hello world pascal tutorial

2/27/02 C. Locke

1. Click on File and then Save Project As from the menu at the top of the screen.

Page 32: Hello world pascal tutorial

2/27/02 C. Locke

2. A small Save As screen will open. It is waiting for further instructions on what you want to name your design. Type helloworld in the File name: box.

Page 33: Hello world pascal tutorial

2/27/02 C. Locke

Learn More

Delphi Object Pascal has a built in Quick Start Tutorial that can be accessed from the Help drop

down menu at the top of the screen.

The tutorial is easy to follow and will guide you on how to create more programs. It will also give you a few more commands that you can try on in your

own programs.

Page 34: Hello world pascal tutorial

2/27/02 C. Locke

Contact Information

Cristal Locke can be contacted through e-mail at [email protected] or through

http://tucker.dade.k12.fl.us/classrooms/Locke/gifted.htm

This tutorial was created on February 10, 2002.

Page 35: Hello world pascal tutorial

2/27/02 C. Locke

More Important

Have fun trying new programs.

More codes can be found and downloaded at:

http://www.dickmann.org/

http://www.negifreebee.com/nfbfprg.html

Maybe one day I will be purchasing one of your home-made programs!