delphi写的九九乘法表

本文将带领初学者了解使用Delphi进行编程的基本概念,通过简单的程序实例,展示了如何利用Delphi创建一个基本的应用程序,涉及界面设计、变量声明、循环结构以及输出操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

初学delphi,最简单的程序了。没有运用到什么高深的东西。

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls;

type
  TForm1 = class(TForm)
    mmo1: TMemo;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
 i,j,s,a,b,c:Integer;
 z,y,u,v:string;
begin
   mmo1.Clear;
  for i := 9 downto 1 do
    begin
      for j := i downto 1 do
         begin
         s:=i*j;
         if s>9 then
            y:='  |'
         else
            y:='    |';
         z:=z+inttostr(i)+'x'+inttostr(j)+'='+inttostr(s)+y;//format('%-5d',[s]);
         end;
      mmo1.Lines.Add(z);
      z:='';
    end;
    for a := 1 to 9 do
    begin
      for b := 1 to  a do
         begin
         c:=a*b;
         if c>9 then
            begin
            u:='  |';
            v:=v+inttostr(b)+'x'+inttostr(a)+'='+inttostr(c)+u;
            end
         else
            begin
            u:='    |';
            v:=v+inttostr(b)+'x'+inttostr(a)+'='+inttostr(c)+u;
            end;

         end;
      mmo1.Lines.Add(v);
      v:='';
    end;

end;
end.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值