Calculadora básica no Lazarus
Publicado por Perfil removido 06/04/2009
[ Hits: 14.686 ]
Seguindo essas instruções e o código fonte desse script você terá uma calculadora básica no Lazarus.
Componentes necessários: Label1=1º NÚMERO Label2=2º NÚMERO Labe3=RESULTADO Button1=Adição Button2=Divisão Button3=Multiplicação Button4=Subtração Button5=Apagar Button6=Sair Código-fonte: unit Ucalculadora; {$mode objfpc}{$H+} interface uses **Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, **Buttons; type **{ TForm1 } **TForm1 = class(TForm) ****ADICAO: TButton; ****SUBTRACAO: TButton; ****DIVISAO: TButton; ****MULTIPLICACAO: TButton; ****APAGAR: TButton; ****SAIR: TButton; ****Edit1: TEdit; ****Edit2: TEdit; ****Edit3: TEdit; ****Label1: TLabel; ****Label2: TLabel; ****Label3: TLabel; ****procedure ADICAOClick(Sender: TObject); ****procedure APAGARClick(Sender: TObject); ****procedure DIVISAOClick(Sender: TObject); ****procedure MULTIPLICACAOClick(Sender: TObject); ****procedure SAIRClick(Sender: TObject); ****procedure SUBTRACAOClick(Sender: TObject); **private ****{ private declarations } **public ****{ public declarations } **end; var **Form1: TForm1; implementation { TForm1 } procedure TForm1.ADICAOClick(Sender: TObject); var n1,n2,calculo:real; begin **n1:=StrToFloat(Edit1.text); **n2:=StrToFloat(Edit2.text); **calculo:=n1+n2; **Edit3.text:=FloatToStr(calculo); end; procedure TForm1.APAGARClick(Sender: TObject); begin **Edit1.text:=''; **Edit2.text:=''; **Edit3.text:=''; end; procedure TForm1.DIVISAOClick(Sender: TObject); var **n1,n2,calculo:real; begin **n1:=StrToFloat(Edit1.text); **n2:=StrToFloat(Edit2.text); **calculo:=n1/n2; **Edit3.text:=FloatToStr(calculo); end; procedure TForm1.MULTIPLICACAOClick(Sender: TObject); var **n1,n2,calculo:real; begin **n1:=StrToFloat(Edit1.text); **n2:=StrToFloat(Edit2.text); **calculo:=n1*n2; **Edit3.text:=FloatToStr(calculo); end; procedure TForm1.SAIRClick(Sender: TObject); begin **Form1.Close; end; procedure TForm1.SUBTRACAOClick(Sender: TObject); var **n1,n2,calculo:real; begin **n1:=StrToFloat(Edit1.text); **n2:=StrToFloat(Edit2.text); **calculo:=n1-n2; **Edit3.text:=FloatToStr(calculo); end; initialization **{$I ucalculadora.lrs} end
Calculadora de décimo terceiro no Lazarus
diferença entre o maior e o menor numero
Calculadora De Decimo Terceiro Salário feita no Lazarus (Delphi 7 para Linux)
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Visualizar arquivos em formato markdown (ex.: README.md) pelo terminal
Dando - teoricamente - um gás no Gnome-Shell do Arch Linux
Como instalar o Google Cloud CLI no Ubuntu/Debian
Mantenha seu Sistema Leve e Rápido com a Limpeza do APT!
Procurando vídeos de YouTube pelo terminal e assistindo via mpv (2025)
Pastas da raiz foram para a área de trabalho [RESOLVIDO] (10)
Será que eu deveria apreender C/C++ para desenvolver para Linux? (4)