Autor Beitrag
Inspecta
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: So 23.11.03 15:15 
Servus!
Ich schreibe am Montag eine Arbeit und wollte Euch fragen ob ihr mir helfen könnt?
Wir sollen eine Tabelle in Delphi machen und z.B. die Zahlen von 1-100 anzeigen lassen!
const n=100
Nun sollen auf Knopfdruck alle nicht-Primzahlen verschwinden und die Primzahlen stehen bleiben.
Array ist integer!
Und die Felder oder wie man es nennt boolean!
Alle die angezeigt werden sollen sind true,alle anderen false!
ich weiß jetzt nicht genau wie ich die ausgabe schreibe,es sollen halt alle true Felder angezeigt werden->anfangs alle, nach Filterung nur Primzahlen!
Als Beispiel eine Filtermethode:
procedure TFrom1.BitBtn1Click(Sender: TObject);
var i,j:integer;
begin
zahlenfeld[1]:=false;{1 is keine Primzahl}
for i:=2 to n div 2 do
for j:=2 to n div i do
if zahlenfeld[i*j]
then zahlenfeld[i*j]:=false;
Ausgabe;
end;

Ich habe noch 2 andere zur Auswahl!
Ich hoffe diese Aufgabe kommt euch nicht zu doof vor aber ich hab damit Probleme. Ich probiers schon aber muss heute noch arbeiten und hab angst das ich es nicht hinkriege.
Als Extra-Aufgabe sollen wir es schaffen den Bereich in dem gefiltert werden soll, selbst zu bestimmen(als Beispiel nicht 1-100 sondern 45-56)!
Am besten denke ich ist dafür Spinedit geeignet.
einmal für die obere und einmal für die untere Grenze.
Doch wie setzt ich das um?
Vielen Dank an Euch!
Inspecta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: So 23.11.03 22:57 
kann mir denn keiner kurz helfen?
bitte!!!! :cry:
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: So 23.11.03 23:44 
Titel: hmm,
bekomm ich dann deine Note ?

_________________
mfg. Joel
Inspecta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: So 23.11.03 23:49 
ich kann sie dir mitteilen!gebt euch mal nen ruck!bidde
ich jammere schon
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mo 24.11.03 01:00 
Hallo,

google mal nach Sieb des Eratosthenes oder so ähnlich. Dann findest du schon nen ansatz. (gibt hinweise auch under www.cenbells.de/wissen.php )

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.