Friday, October 23, 2020

Addition of Two Numbers in Delphi

 A simple program that I wrote using Borland Delphi to ask the user to give two numbers and then the program will compute the sum of two numbers and display the results in the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking and Arduino Project development at a very affordable price.







Program Listing

unit Addition;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if MessageDlg('Do you really want to quit?', mtConfirmation,
      [mbYes, mbNo], 0) = mrYes then
    Close
  else
    form1.show;
end;


procedure TForm1.Button2Click(Sender: TObject);
var a,b : integer;
    x,y,sum : string;

begin
    x := edit1.Text;
    y := edit2.Text;

    a := StrToInt(x);
    b := StrToInt(y);

    sum := IntToStr(a+b);

    label4.caption := 'The sum of ' +x + ' and '
                + y + ' is ' + sum + '.';
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
   edit1.Text := '';
   edit2.Text  := '';
   label4.caption :='';
   edit1.SetFocus;
end;

end.

No comments:

Post a Comment