Delphi의 Firemonkey에서 FizzBuzz를 시도했습니다.
                                            
                                                
                                                
                                                
                                                
                                                
                                                 6896 단어  델파이
                    
Delphi의 Firemonkey에서 FizzBuzz를 시도했습니다.
일이 트위터에서 팔로워 씨의 @pik 씨가 델파이에서 최소 문자 수로 FizzBuzz를 만들었습니다.
완성 이미지를 폼으로 시작과 종료의 수치를 입력할 수 있고 버튼을 누르면 실행되어 폼 화면상에서 결과를 확인할 수 있는 것을 상정해 작성했습니다
Delphi이므로 하나의 소스 파일로 Win도 Mac에도 움직입니다.
Win7 버전 스크린샷
 
MacOSX용 스크린샷
 
소스 코드
p.pas
unit p;
interface
uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.Layouts,
  FMX.Memo, FMX.Edit;
type
  Tf = class(TForm)
    b: TButton;
    L1: TLabel;
    L2: TLabel;
    e1: TEdit;
    e2: TEdit;
    m: TMemo;
    procedure bClick(Sender: TObject);
  private
  public
  end;
var
  f: Tf;
implementation
{$R *.fmx}
procedure Tf.bClick(Sender: TObject);
var
  i: Integer;
  s: String;
begin
  for i := e1.Text.ToInteger to e2.Text.ToInteger do
  begin
    s := '';
    if (i mod 3 = 0) then
    begin
      s := 'Fizz';
    end;
    if (i mod 5 = 0) then
    begin
      s := s + 'Buzz';
    end;
    if (s = '') then
    begin
      s := i.ToString;
    end;
    m.Text := m.Text + s + #13#10;
  end;
end;
end.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Delphi의 Firemonkey에서 FizzBuzz를 시도했습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/whtera/items/0cc617f17c55ba20cabe
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
unit p;
interface
uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.Layouts,
  FMX.Memo, FMX.Edit;
type
  Tf = class(TForm)
    b: TButton;
    L1: TLabel;
    L2: TLabel;
    e1: TEdit;
    e2: TEdit;
    m: TMemo;
    procedure bClick(Sender: TObject);
  private
  public
  end;
var
  f: Tf;
implementation
{$R *.fmx}
procedure Tf.bClick(Sender: TObject);
var
  i: Integer;
  s: String;
begin
  for i := e1.Text.ToInteger to e2.Text.ToInteger do
  begin
    s := '';
    if (i mod 3 = 0) then
    begin
      s := 'Fizz';
    end;
    if (i mod 5 = 0) then
    begin
      s := s + 'Buzz';
    end;
    if (s = '') then
    begin
      s := i.ToString;
    end;
    m.Text := m.Text + s + #13#10;
  end;
end;
end.
Reference
이 문제에 관하여(Delphi의 Firemonkey에서 FizzBuzz를 시도했습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/whtera/items/0cc617f17c55ba20cabe텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)