Delphi典型例子.doc
《Delphi典型例子.doc》由会员分享,可在线阅读,更多相关《Delphi典型例子.doc(11页珍藏版)》请在一课资料网上搜索。
1、习题1procedure TForm1.Button1Click(Sender: TObject);begin if (edtName.Text=admin)and(edtPass.Text=123456) then begin showmessage(豋录成功。); end else showmessage(姓名戓密码错。);end;习题2var Form1: TForm1;implementation$R *.dfm const iname=user; ipassword=00000;procedure TForm1.Button1Click(Sender: TObject);begin
2、if ( edit1.text=iname)and(edit2.text=ipassword) then ShowMessage( 欢迎使用学生管理系统)else MessageDlg( 用户名或密码不正确,请重新输入!,mtError,mbOk,0);end;习题3var r,c,s:real;const pi=3.14159; / 常量的定义beginr:=strtofloat(edit1.Text);c:=2*pi*r;s:=pi*sqr(r);label2.Caption:=该圆的周长为:+floattostr(c)+ +chr(13)+面积为:+floattostr(s);end;p
3、rocedure TForm1.Button2Click(Sender: TObject);beginclose;end;习题4if 2 1 then begin a:=A;end else c:=Cend;求分段函数的值:procedure TForm1.Button1Click(Sender: TObject);varx,y:real;begin x:=strtofloat(edit1.text); y:=x2+x*x-x+2; edit2.Text:=floattostr(y);end;procedure TForm1.Button2Click(Sender: TObject);begi
4、nclose;end;(*清除按钮的OnClick事件处理代码*)procedure TForm1.Button2Click(Sender: TObject);begin Edit1.Text:=; Edit2.Text:=; Edit3.Text:=; Edit4.Text:=;end;习题4procedure TForm1.Button3Click(Sender: TObject);beginClose;begin if Label1.Visible then begin Label1.Visible:=False; /如果是显示的,则隐藏 Button1.Caption:=显示; end
5、 else begin Label1.Visible:=True; /如果是隐藏的,则显示 Button1.Caption:=隐藏; end;end;习题5procedure TForm1.Button1Click(Sender: TObject);var year:Integer; flag:Boolean;begin year:=StrtoInt(Edit1.text); /将字符串转变为整型 if year mod 4 = 0 then begin if year mod 100 =0 then begin if year mod 400=0 then flag:=true else f
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Delphi 典型 例子
一课资料网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。



图解生物化学(英文版)Harper's Illustrated Biochemistry(26th.pdf
【寄生虫】一些总结共同点(纵向).doc
(教科版)五年级科学下册课件_热起来了5.ppt

![MLSPGO8Q0C2L%`J2QI2M]C3.png](https://www.ekdoc.com/FileUpload/ueditor_s/upload/2020-5/8/6372452921073120799898817.png)


