DELPHI语言基础知识教材.ppt

DELPHI语言基础知识教材.ppt

ID:55339693

大小:786.50 KB

页数:100页

时间:2020-05-14

DELPHI语言基础知识教材.ppt_第1页
DELPHI语言基础知识教材.ppt_第2页
DELPHI语言基础知识教材.ppt_第3页
DELPHI语言基础知识教材.ppt_第4页
DELPHI语言基础知识教材.ppt_第5页
资源描述:

《DELPHI语言基础知识教材.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、DELPHI语言基础DELPHI语言基础DELPHI语言基础常量无需定义1、整型常量2、实数常量3、布尔常量4、字符常量5、字符串常量字面常量DELPHI语言基础常量符号常量需定义语法规则:const<常量标识符>=<常量或常量表达式>注:没有“:”号。例:constpi=3.14;//正确pi1=abc//错误pi2=-pi;//正确pi=-k//错误(即使k被定义为变量)DELPHI语言基础unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,C

2、lasses,Graphics,Controls,;typeTForm1=class(TForm)Button1:TButton;procedureButton1Click(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;varForm1:TForm1;constpi=3.14;implementation{$R*.dfm}procedureTForm1.Button1Click(Sender:TObject);

3、constpi=3.1415;beginend;end.DELPHI语言基础变量语法规则:var<变量标识符>:<变量类型>例:varX:integer;Y,z:string;注:不区分大小写unitUnit1;interfaceusesSysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Button1:TButton;procedureButton1Click(Sender:TObj

4、ect);private{Privatedeclarations}public{Publicdeclarations}i:integer;end;varForm1:TForm1;i:integer;x,y:string;implementation{$R*.dfm}procedureTForm1.Button1Click(Sender:TObject);vari:integer;st:string;beginend;end.DELPHI语言基础类型常量语法规则:const<常量标识符>:<数据类型>=<常量或常

5、量表达式>注:没有“:”号。例:constpi:integer=3.14;//正确pi1:string=abc//错误符号常量和类型常量唯一不同:类型常量指定了类型。DELPHI语言基础unitUnit1;interfaceusesSysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Button1:TButton;procedureButton1Click(Sender:TObject

6、);private{Privatedeclarations}public{Publicdeclarations}end;varForm1:TForm1;constpi:integer=3;pi1:string=‘abc’;implementation{$R*.dfm}procedureTForm1.Button1Click(Sender:TObject);constpi:integer=3.14;pi1:string=abcbeginend;end.DELPHI语言基础DELPHI语言基础自定义类型语法规则:t

7、ype<标识符>=<数据类型表达式>注:没有“:”号。例:typeint=integer;//int代替integer类型str=array[1..10]ofstring;//str代替string数组DELPHI语言基础unitUnit1;interfaceusesSysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Button1:TButton;procedureButton1Cl

8、ick(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;Typeint=integer;str=array[1..10]ofstring;varForm1:TForm1;implementation{$R*.dfm}procedureTForm1.Button1Click(Sender:

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。