Autor Beitrag
Christian V.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Fr 06.04.07 11:24 
Hallo,
Kann ich zur Laufzeit bestimmte Werte(Zahlen) zu einer Menge(Set of) hinzufügen?

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 06.04.07 11:25 
Moin!

Ja! ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Christian V. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Fr 06.04.07 11:39 
Danke für deine Hilfreiche Antwort.
Und wie mach ich das nun? Hab mich shcon mit der Boardsuche bemüht, hab aber nichts konkretes gefunden.

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 06.04.07 11:51 
user profile iconinvulnerabilis hat folgendes geschrieben:
Danke für deine Hilfreiche Antwort.

user profile iconNarses hat nur deine Frage beantwortet. Seine Antwort war also vollkommen korrekt.

user profile iconinvulnerabilis hat folgendes geschrieben:
Und wie mach ich das nun?

Neue Frage, neuer Thread :mahn: :mrgreen:

Ganz einfach: Mit + und dem hinzuzufügenden Element. Ansonsten DOH Abschnitt Object Pascal Reference ODER Set of + F1.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 06.04.07 11:51 
Moin!

Zeig doch mal die Deklaration deiner Menge (notwendig) und was du bisher probiert hast (optional).

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
ub60
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 764
Erhaltene Danke: 127



BeitragVerfasst: Fr 06.04.07 12:40 
Nur mal schnell gehackt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var CharSet : Set of Char;

procedure TForm1.Button1Click(Sender: TObject);
var s : String;
    c : Char;
begin
  CharSet:=CharSet+['e'];
  CharSet:=CharSet+['h','k'];
  s:='';
  for c:='a' to 'm' do
    if c in CharSet
      then s:=s+c;
  Edit1.Text:=s;    
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Charset:=['a','b','c','d'];
end;


Das sollte gehen.

ub60
Christian V. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Fr 06.04.07 13:28 
Danke für die zahlreichen Antworten. hat geklappt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
type
use= set of 1..81;
var
used:use;
c:char;
i:integer;
begin
used:=[];
  for i:= 1 to 81 do begin
    if field[i].text<> '' then begin
      if field[i].text[1in ['1'..'9']  then begin

         used:=used+[i];
      end
      else ShowMessage('Bitte überprüfen sie ihre eingabe, Feld '+IntToStr(i)+' beinhaltet keine Zahl im Bereich 1 bis 9');
    end;
  end;
end;


//Edit: Bin gerade an einem neuen Sudoku Lösungsprogramm.

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?