Autor Beitrag
tim_ossi
Hält's aus hier
Beiträge: 5

Windows XP Home

BeitragVerfasst: Do 13.10.05 16:47 
Habe folgenden Programmstream und bekomme ihn incht richtig zum laufen
Bräuchte hilfe bitte.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Button2: TButton;
    Button3: TButton;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
jahr : integer;
x1, x2, x3, schaltjahr : boolean;

procedure TForm1.Button1Click(Sender: TObject);
begin
x1 := jahr mod 4 = 0;
x2 := jahr mod 100 <> 0;
x3 := jahr mod 400 = 0;
schaltjahr := ((x1 and x2) or (x3));

{label4.caption:=booltostr;    }
label5.caption:='x2';
label6.caption:='x3';
label7.caption:='schaltjahr';

if schaltjahr then
   label3.caption := 'Das zu prüfende Jahr ist ein Schaltjahr!'
   else
      label3.Caption := 'Das zu prüfende Jahr ist kein Schaltjahr!';


end;

procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Close;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Edit1.Text :='';
Label3.Caption :='';
Edit1.SetFocus;
end;

end.


Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt.


Zuletzt bearbeitet von tim_ossi am Do 13.10.05 17:53, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 13.10.05 16:53 
Moin und :welcome: im Forum!

Du solltest deinen Code mit den Delphi-Tags umschließen [ delphi ] und [ /delphi ] (wobei die Leerzeichen in den Klammern wegzulassen sind, damit der Code brauchbar formatiert dargestellt wird.

Weiterhin würdest du uns deutlich helfen, wenn du uns noch verrätst, WAS GENAU denn nicht geht! :wink:

cu
Narses
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 13.10.05 17:01 
Worum es geht, weiss doch wohl jeder der Quelltext ist Ja kommentiert aber leider hat Dir - der Jemand nur einen gewissen Teil vom Code gegeben.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 13.10.05 17:17 
Moin!

Ach user profile iconBlackheart666, du bist mein Held; wenn ich nicht schon Lesen könnte, wäre mir das erst jetzt klar geworden... :roll: Aber zum Glück hast du uns ja nochmal klar gesagt, dass du sogar unformatierten Code lesen kannst; wir sollten dich zum inoffiziellen Code-Enträtsler für jeden dahergelaufenen Code-c&p-ler ernennen... :mrgreen:

Allerdings scheint dir entgangen zu sein, dass diese Frage auf etwas ganz Anderes abzielt... :wink:

cu
Narses
tim_ossi Threadstarter
Hält's aus hier
Beiträge: 5

Windows XP Home

BeitragVerfasst: Do 13.10.05 17:23 
Das Programm soll ermitteln welche Jahre Scahltjahre sind. Aber egal welches Jahr ich eingebe es ist immer ein Schaltjahr.
Was ich nicht verstehe ist wie das Programm die infomartionen aus dem "Edit1" holt.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 13.10.05 17:31 
user profile icontim_ossi hat folgendes geschrieben:
Was ich nicht verstehe ist wie das Programm die infomartionen aus dem "Edit1" holt.
Ich auch nicht ;-)
Denn das wird überhaupt nicht gemacht. Die globale Variable "Jahr" ist somit immer 0 (damit wird sie automatisch initialisiert) und das ist deinen Bedingungen zufolge ein Schaltjahr gewesen.

_________________
We are, we were and will not be.
tim_ossi Threadstarter
Hält's aus hier
Beiträge: 5

Windows XP Home

BeitragVerfasst: Do 13.10.05 17:36 
wie mach ich denn das er das tut?
Hab immer Probleme mit den Typ und Klassen (boolean, integer und string.
könntze mir da jemand helfen?

Tim :?:
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 13.10.05 17:40 
Warum Beantwortest Du die Frage dann nicht einfach....
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 13.10.05 17:52 
ausblenden Delphi-Quelltext
1:
jahr := StrToInt(Edit1.Text);					


btw.: Bitte ändere noch den Titel des Topics, da der jetzige ziemlich wenig über das eigentliche Problem aussagt. Danke!

_________________
We are, we were and will not be.
tim_ossi Threadstarter
Hält's aus hier
Beiträge: 5

Windows XP Home

BeitragVerfasst: Do 13.10.05 17:54 
vielen dank für die hilfe werd in zukunft direkt das problem genau beschreiben. :wink:
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 13.10.05 18:23 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if DaysInAMonth(StrToInt(Edit1.Text), 2) = 29 then
    ShowMessage('Das Jahr ist ein Schaltjahr.')
  else
    ShowMessage('Das Jahr ist kein Schaltjahr.');


Mach es nicht so kompliziert und nimm das.
Aber bitte kopiere und füge nicht einfach ein, sondern
überlege was da steht. Danke.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 14.10.05 12:32 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
 if IsLeapYear (StrToInt(Edit1.Text)) then Caption:='Schaltjahr' else Caption:='Kein Schaltjahr';
end;
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 14.10.05 12:36 
Die Funktion hab ich schon gesucht...

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)