Hi, Leutz
Ich wollte mal son rechen programm machen und ich bin soweit auch fertig, nur ich weiß nicht, wie man die aufgaben zwischen +,-,* wechselt und das das eine editfeld grün wird wenn es richtig ist und es rot wird wenn es falsch ist und ein kommentar dazu steh, also ob es falsch oder richtig ist. Wie man das mit plus minus oder mal macht weiß ich, und alles andere auch, aber nicht wie das dazwischen welchselt, also das der sich das aussucht wenn man auf einen button drückt. bisher steht das hier
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:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Button1: TButton; Panel2: TPanel; Panel4: TPanel; Edit1: TEdit; Panel5: TPanel; Button2: TButton; Edit2: TEdit; Edit3: TEdit; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Button2Click(Sender: TObject);
private public end;
var Form1: TForm1; zahl2 : integer; zahl1 : integer; aufgabenart : integer;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject); begin zahl1 := random(10); zahl2 := random(10); edit1.text := inttostr(zahl1); edit2.text := inttostr(zahl2); edit3.color := clwhite; edit3.text := '';
panel2.caption := '+';
end;
procedure TForm1.FormCreate(Sender: TObject); begin randomize; end;
procedure TForm1.Button2Click(Sender: TObject); begin if edit3.text = inttostr(zahl1+zahl2) then begin panel5.caption := 'Richtig'; edit3.color := cllime; end else begin panel5.caption := 'Falsch'; edit3.color := clred; end; end;
end. |
also wie macht man das?
mfg:somebody