AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Ratezahl 2 Delphi (leicht)

Ein Thema von andiak · begonnen am 1. Nov 2007 · letzter Beitrag vom 2. Nov 2007
 
andiak

Registriert seit: 1. Nov 2007
89 Beiträge
 
#39

Re: Ratezahl 2 Delphi (leicht)

  Alt 2. Nov 2007, 12:38
hm oki mach ich das nächste mal ich habe erst dort dann hier gepostet und da hier zu erst geholfen wurde bin ich hier geblieben und dort net mehr nachgeschaut....
ich glube ich bin jetzt soweit fertig... ich kann ja nochmall den kommpletten code posten kann mir jemand vieleicht nen tipp geben wie man den jetzt noch schön formatieren kann? Also nur Einrückungen z.b. alle if´s, 1Tabstop oder so

Delphi-Quellcode:
unit UZahl;

interface

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

type
  TForm1 = class(TForm)
    EEingabe: TEdit;
    BNeu: TButton;
    BRaten: TButton;
    PAntwort: TPanel;
    ScrollBar: TScrollBar;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Button1: TButton;
    Label7: TLabel;
    Label6: TLabel;
    procedure NeueZahl(Sender: TObject);
    procedure Vergleiche(Sender: TObject);
    procedure BleibHier(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);

  private
    { Private-Deklarationen }
    Zahl: Integer;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  count : integer;


implementation

{$R *.DFM}

procedure TForm1.NeueZahl(Sender: TObject);
begin
  Zahl := Random(100);
  ScrollBar.Position := Zahl
end;

procedure TForm1.BleibHier(Sender: TObject);
begin
  ScrollBar.Position := Zahl
end;

procedure TForm1.Vergleiche(Sender: TObject);
begin
count := count + 1;
Label4.Caption := IntToStr( count);
if count = 10 then
begin
  Label4.Caption := 'Maximale Rateanzahl erreicht, die Lösung ist: , Neue runde?';
  BRaten.Enabled := false ;
  Label7.Caption := IntToStr ( Zahl);
    end;

  if StrToInt(EEingabe.Text) > Zahl then
begin
     PAntwort.Caption := 'zu groß' ;
    PAntwort.Color := clred ;
    if (abs(zahl - StrtoInt (Eeingabe.Text)) > 0) and (abs(zahl - StrtoInt (Eeingabe.Text)) < 5) then PAntwort.caption := 'Du bist ganz nah dran, aber die Zahl ist zu groß!else
if (abs(zahl - StrtoInt (Eeingabe.Text)) > 5) and (abs(zahl - StrtoInt (Eeingabe.Text)) < 15) then PAntwort.caption := 'Es wird wärmer, aber noch ist die Zahl zu groß...'
end;
if StrToInt (EEingabe.Text) < Zahl then
begin
     PAntwort.Caption := 'Zu klein' ;
    PAntwort.Color := clred ;
    if (abs(zahl - StrtoInt (Eeingabe.Text)) > 0) and (abs(zahl - StrtoInt (Eeingabe.Text)) < 5) then PAntwort.caption := 'Du bist ganz nah dran, aber die Zahl ist noch etwas zu klein!else
if (abs(zahl - StrtoInt (Eeingabe.Text)) > 5) and (abs(zahl - StrtoInt (Eeingabe.Text)) < 15) then PAntwort.caption := 'Es wird wärmer, aber noch ist die Zahl zu klein...'
end;
if StrToInt (EEingabe.Text) = Zahl then
begin
    PAntwort.Caption := 'Richtig!';
    PAntwort.Color := cllime ;
    Label6.Caption := 'Ihr habt gewonnen!!! Probiert es gleich nochmal'
end;


end;

procedure TForm1.FormCreate(Sender: TObject);
begin
count := 0;
Randomize;
Zahl := Random(100);
  ScrollBar.Position := Zahl

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
count := 0;
BRaten.Enabled := true ;
Label4.Caption := '' ;
Zahl := Random(100);
  ScrollBar.Position := Zahl ;
  Label7.Caption := ''      ;
  Label6.Caption := ''

end;

end.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz