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
Antwort Antwort
Seite 7 von 7   « Erste     567   
Benutzerbild von Aurelius
Aurelius

Registriert seit: 29. Jan 2007
Ort: Erfurt
753 Beiträge
 
Delphi 7 Personal
 
#61

Re: Ratezahl 2 Delphi (leicht)

  Alt 2. Nov 2007, 15:01
So könnte es aussehen. recht übersichtlich...

Delphi-Quellcode:
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;
Jonas
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 7 von 7   « Erste     567   


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 21:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz