Review the console program of Delphi: Hello world!

Source: Internet
Author: User

During the development of ActiveX using C # in the past two days, no matter how it is done, C # cannot generate pure ActiveX controls for ocx, and it also forces users to install huge ones. net Framework (I just want to make a simple screenshot function ActiveX integrated into the Silverlight chat room), so I think of Delphi, which has been used for a year, although time passes, now it is. net, but it is undeniable that Delphi is still a Win32 nativeProgramOne of the best development tools.

For more information about Delphi syntax, see the CHM document.

Http://d.namipan.com/d/d026cf6a2a78de9569248d7579fc2adccb3f8e01e5ba5500
First, create a leleapplication (DOS window program)

File --> New --> Other --> console application

CodeAs follows:

Program Project1;
{ $ Apptype Console }
Uses   // Equivalent to the using namespace
Sysutils;


var // define variable
I: integer;
S: string ;< BR >_ set : set of char; // set type

Const
Author:String ='Jimmy';//Constant string

Resourcestring
Author2= 'Yjmyzz';//Resource string

//Define a process
ProcedureMyproc (MSG:String);
Begin
Writeln ('Myproc is called:' +MSG );
End;

// Define a function
Function Myfunc (MSG: String ): String ;
Begin
Result: =   ' Myfunc is called '   + MSG;
End ;

// Start of main method
Begin
Writeln ( ' Hello World ' ); // Output, equivalent to console. writeln ("XXX") in C ")
Writeln ( '' );
For I: = 0   To   10   Do   // Loop
Begin
S: =   ' This is a number '   + Inttostr (I );
Writeln (s );
End ;
Writeln ( ' -------------------------- ' );
Myproc ( ' Jimmy ' ); // Call Process
Writeln (myfunc ( ' Jimmy. Yang ' )); // Call a function
Writeln ( ' -------------------------- ' );
Writeln (author ); // Output constant
Writeln (author2 ); // Output resource string
Writeln ( ' -------------------------- ' );
Writeln ( ' Integer: ' );
Writeln (sizeof (integer ));
Writeln (high (integer ));
Writeln (low (integer ));
Writeln ( ' -------------------------- ' );
Writeln ( ' I = '   + Inttostr (I ));
Dec (I ); // I minus 1, equivalent to I: = I - 1 ;
I: = I - 1 ;
Writeln ( ' I = '   + Inttostr (I ));
Writeln (ODD (I ));
Writeln ( ' -------------------------- ' );
Writeln (formatdatetime ( ' Yyyy-mm-dd hh: NN: SS ' , Now ));
Writeln ( ' -------------------------- ' );
I: = INTEGER ( ' A ' );
Writeln (I );
Writeln (ord ( ' A ' ));
Writeln (CHR ( 97 ));
Writeln (# 10   +   ' Press any key to exit... ' );
Readln; // Wait for keyboard input
End .

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.