<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Dynamisches Feld Durchsuchen]]></title><description><![CDATA[<p>Hi,</p>
<p>wie kann man eine Dynamisches Feld nach einem Wert durchsuchen ?</p>
<p>In Blitz3d sieht das so aus :</p>
<p>TYPE crafts<br />
FIELD x<br />
FIELD y<br />
END TYPE</p>
<p>FOR t = 1 TO 100<br />
alien.crafts = NEW crafts<br />
alien\x = RND(0,640)<br />
alien\y = RND(0,480)<br />
NEXT</p>
<p>Ausgabe eines Wertes :<br />
FOR alien.crafts = EACH crafts<br />
PRINT alien\x<br />
NEXT</p>
<p>Wie muss dieses in C++ umgesetzt werden ?</p>
<p>Erstelle Klasse:</p>
<p>class crafts<br />
{<br />
public:<br />
float *x;<br />
float *y;<br />
}</p>
<p>Erzeuge einen Eintrag:</p>
<p>crafts *alien;<br />
alien.x = 500;<br />
alien.y = 250;</p>
<p>Ausgabe aller Crafts ?</p>
<p>Danke<br />
Gruß<br />
Schoppy</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173195/dynamisches-feld-durchsuchen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 05:29:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173195.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Feb 2007 18:58:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamisches Feld Durchsuchen on Mon, 12 Feb 2007 18:58:22 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wie kann man eine Dynamisches Feld nach einem Wert durchsuchen ?</p>
<p>In Blitz3d sieht das so aus :</p>
<p>TYPE crafts<br />
FIELD x<br />
FIELD y<br />
END TYPE</p>
<p>FOR t = 1 TO 100<br />
alien.crafts = NEW crafts<br />
alien\x = RND(0,640)<br />
alien\y = RND(0,480)<br />
NEXT</p>
<p>Ausgabe eines Wertes :<br />
FOR alien.crafts = EACH crafts<br />
PRINT alien\x<br />
NEXT</p>
<p>Wie muss dieses in C++ umgesetzt werden ?</p>
<p>Erstelle Klasse:</p>
<p>class crafts<br />
{<br />
public:<br />
float *x;<br />
float *y;<br />
}</p>
<p>Erzeuge einen Eintrag:</p>
<p>crafts *alien;<br />
alien.x = 500;<br />
alien.y = 250;</p>
<p>Ausgabe aller Crafts ?</p>
<p>Danke<br />
Gruß<br />
Schoppy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227680</guid><dc:creator><![CDATA[Schoppy79]]></dc:creator><pubDate>Mon, 12 Feb 2007 18:58:22 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisches Feld Durchsuchen on Mon, 12 Feb 2007 19:35:20 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>wie kann man eine Dynamisches Feld nach einem Wert durchsuchen ?<br />
Ausgabe aller Crafts ?</p>
</blockquote>
<p>Was denn nun? Ausgabe oder Suche? Was genau meinst du mit dynamisches Feld?</p>
<p>Eine Umsetzung in C++ sollte auch die Mittel von C++ nutzen, hier ein Minimalbeispiel</p>
<pre><code class="language-cpp">class crafts
{
public:
float x; // Warum Zeiger?
float y;
crafts() : x(0), y(0) {}; // Standardkonstruktor
crafts(floar x_, float y_) : x(x_), y(y_) {}; // Konstruktor mit paramtern
}
...
std::vector&lt;crafts&gt; mycrafts // Dynamischer Vektor
mycrafts.push_back(crafts(500, 250)); // Neues Element in dynamischen vektor einfügen
...
for (int lv = 0; lv &lt; mycrafts.size(); ++lv)
  std::cout &lt;&lt; crafts[lv].x &lt;&lt; std::endl;
</code></pre>
<p>Das Suchen an sich muß du mit einer Schleife und einer passenden Bedingung erledigen (oder std::find).</p>
<p>Btw : sfds</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1227709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1227709</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 12 Feb 2007 19:35:20 GMT</pubDate></item></channel></rss>