This will be my first time to successfully understand and run a Delphi program that I wrote before I have some difficulty in understanding this programming language that is super set of Pascal programming language. It is very easy to write a code in Delphi once you have a good understanding of its environment, tools and of course the Pascal programming language.
In this sample program will ask the user to give two numbers and then our program will compute the sum of the two numbers given by the user. I have a great time learning Delphi it is very similar to Visual Basic the only difference is that it uses Pascal as its primarily programming language. Easy to learn and very fast to run the program.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
add.pas
unit add;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Var a,b : integer;
procedure TForm1.Button1Click(Sender: TObject);
begin
a:= strtoint(edit1.text);
b:= strtoint(edit2.text);
edit3.text := inttostr(a+b);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
edit2.text := '';
edit3.text := '';
edit1.setfocus;
end;
end.
No comments:
Post a Comment