Let's first introduce Hello, world
"Hello, world"Program means to output" Hello, world! "only on the computer screen !" ("World, hello !") The computer program of this line of string. In general, this is the most basic and simple program in every computer programming language, and is usually the first program written by beginners. It can also be used to determine whether the language's compiler, program development environment, and runtime environment has been installed properly.
Using the output string "Hello World" as the first demonstration program has become a tradition of programming language learning. This program is based on the Computer Programming Tutorial C programming language (The C Programming Language) Is widely used, but this book is not a "hello World" abuse, although this is a common misunderstanding.
The "Hello World" sample program was first introduced in 1972 in introduction to the Language B, an internal technical file written by Brian corlinhan, a member of Bell Labs. The example of programming in C: A tutorial, which was written by the author in 1974, was also extended. This demonstration program was also retained in the C programming language developed by this document.
At first, the standard print content of the "Hello, world" program must be "all lowercase, no exclamation point, and a space should be blank after the dot ". However, it is rare to stick to the tradition.
Create the simplest console applicationstep 1,
OpenDelphi7, Click the menu"File | new | Other...", Select"Console Application". For example:
Step 2,
By default,Project1.dprFile, such:
Step 3,
The code in the red box is all the code of the program. The specific explanation is as follows:
Program project1; {starts with a critical program} {$ apptype console} {indicates that the program is a console program} uses {reference list of units used} sysutils; begin {begin .. program code in end} {todo-ouser-cconsole main: insert code here} end. {end. end of the program}
Step 4,
Below weBegin.. EndAdd the code that displays the Hello, world function, as follows:
Begin {begin .. end is the program code} writeln ('hello, World'); readln; end. {end. End of the program}
Step 5
Run F9 as follows:
At this point, a simple console program has been completed.
Lab
Project 1. EXE of the Program Generation executable file is42kbIf the uses field in the Code is missing (because writelnand readlnare not used in the Unit, the size of project1.exe is16 KB. It seems that the included and excluded sysutils units are very different.