Relive the Delphi console program: Hello world!

Source: Internet
Author: User

The original: Relive the console program of Delphi: Hello world!

This two-day development of ActiveX in C #, found no matter how, C # is no way to generate OCX pure ActiveX control, but also to force users to install a huge. Net The framework (I just want to do a simple screenshot of the ActiveX integration into the Silverlight chat room), and then think of the once used for a year of Delphi, although the passage of time, As early as the world of. NET, it is undeniable that Delphi is still one of the best development tools for Win32 native programs.

About Delphi Grammar Learning, you can see this CHM document, basically a day to read

http://d.namipan.com/d/d026cf6a2a78de9569248d7579fc2adccb3f8e01e5ba5500
First to make a consoleapplication (that is, DOS window program)

File-->new-->other-->console Application

The code is as follows:

ProgramProject1;
{$APPTYPE CONSOLE}
uses //equivalent to a using namespace
Sysutils;


var  //Defining variables
I:integer;
S:string;
_Set:Set  ofChar;//collection type

Const
Author:string ='Jimmy';//constant string

resourcestring
Author2= 'Yjmyzz';//Resource string

//Define a process
procedureMyProc (msg:string) ;
begin
Writeln ('MyProc is called by:' +msg);
End;

//Define a function
functionMyFunc (msg:string):string;
begin
Result:= 'MyFunc is called by' +msg;
End;

//the beginning of the Main method
begin
Writeln ('Hello World');//output, equivalent to Console.writeln ("xxx") in C #
Writeln ("');
forI:=0  to Ten  Do //Loops
begin
S:= 'This is a number .' +IntToStr (i);
Writeln (s);
End;
Writeln ('--------------------------');
MyProc ('Jimmy'); //Call procedure
Writeln (MyFunc ('Jimmy.yang')); //calling functions
Writeln ('--------------------------');
Writeln (Author); //Output Constants
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 month DD Day HH:NN:SS', now));
Writeln ('--------------------------');
I:=Integer ('A');
Writeln (i);
Writeln (Ord ('a'));
Writeln (CHR ( the));
Writeln (#Ten + 'Press any key to exit ...');
READLN; //Wait for keyboard input
End.

Relive the Delphi console program: Hello world!

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.