Cari Blog Ini

Selasa, 30 November 2010

delphi nim calculating

Created with Delphi 7 by Avid/Kira
Nim calculating

Sintak:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
na: TEdit;
Edit4: TEdit;
Button1: TButton;
Button2: TButton;
nh: TLabel;
IP: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
angka:integer;
bobot:integer;
begin
angka:=strtoint(na.text);
if((angka<=100)and(angka>=85))then
begin
bobot:=4;
nh.caption:='A';
end else
if((angka<=84)and(angka>=70))then
begin
bobot:=3;
nh.caption:='B';
end else
if((angka<=69)and(angka>=55))then
begin
bobot:=2;
nh.caption:='C';
end else
if((angka<=54)and(angka>=40))then
begin
bobot:=1;
nh.caption:='D';
end else
begin
bobot:=0;
nh.caption:='E';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var bobot:integer;
begin
IP.Caption:=floattostr(strtoint(edit4.text)*bobot);
end;

end.

Tidak ada komentar:

Posting Komentar