<?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[[gelöst] Problem bei Algorythmus]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe gestern versucht das<br />
<a href="http://primzahlen.de/files/theorie/sieb.htm" rel="nofollow">Sieb des Eratosthenes</a> nachzubaun. Aber irgentwie will das ganze nicht so ganz funktionieren.<br />
Denn der int Array lässt sich nicht erzeugen.</p>
<p>Hoffentlich könnt ihr mir Helfen !</p>
<p>Hier mal meinen Code.</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
using namespace std;

 int main() {
	  int Zahl = 999;
	  int ZahlSqrt = static_cast&lt;int&gt;(sqrt(static_cast&lt;double&gt;(Zahl)));

	  int aMatch[Zahl];

	  int MatchIndex = 0;
	  bool Match = false;

	  for (int x=2;x&lt;Zahl;x++) {
		  for (int Teiler=2;Teiler&lt;ZahlSqrt;Teiler++) {
			  if (!(x%Teiler)) {
				  Match = true;
				  break;
			  }
		  }
		  if (!Match) {
			  aMatch[MatchIndex] = x;
				  MatchIndex++;
		  }
		  Match = false;
	  }

	  for (int x=0;x&lt;MatchIndex;x++) {
		  cout&lt;&lt;aMatch[x]&lt;&lt;&quot;\n&quot;;
	  }

	  system(&quot;pause &gt;nul&quot;);
	  return 0;
 }
</code></pre>
<p>Und hier ist die funktionierende AutoIt variante <a href="http://autoit.pastebin.com/azCrLxWe" rel="nofollow">http://autoit.pastebin.com/azCrLxWe</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270506/gelöst-problem-bei-algorythmus</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 02:18:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270506.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Jul 2010 18:52:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [gelöst] Problem bei Algorythmus on Tue, 13 Jul 2010 19:21:39 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe gestern versucht das<br />
<a href="http://primzahlen.de/files/theorie/sieb.htm" rel="nofollow">Sieb des Eratosthenes</a> nachzubaun. Aber irgentwie will das ganze nicht so ganz funktionieren.<br />
Denn der int Array lässt sich nicht erzeugen.</p>
<p>Hoffentlich könnt ihr mir Helfen !</p>
<p>Hier mal meinen Code.</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
using namespace std;

 int main() {
	  int Zahl = 999;
	  int ZahlSqrt = static_cast&lt;int&gt;(sqrt(static_cast&lt;double&gt;(Zahl)));

	  int aMatch[Zahl];

	  int MatchIndex = 0;
	  bool Match = false;

	  for (int x=2;x&lt;Zahl;x++) {
		  for (int Teiler=2;Teiler&lt;ZahlSqrt;Teiler++) {
			  if (!(x%Teiler)) {
				  Match = true;
				  break;
			  }
		  }
		  if (!Match) {
			  aMatch[MatchIndex] = x;
				  MatchIndex++;
		  }
		  Match = false;
	  }

	  for (int x=0;x&lt;MatchIndex;x++) {
		  cout&lt;&lt;aMatch[x]&lt;&lt;&quot;\n&quot;;
	  }

	  system(&quot;pause &gt;nul&quot;);
	  return 0;
 }
</code></pre>
<p>Und hier ist die funktionierende AutoIt variante <a href="http://autoit.pastebin.com/azCrLxWe" rel="nofollow">http://autoit.pastebin.com/azCrLxWe</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925794</guid><dc:creator><![CDATA[Sprenger120]]></dc:creator><pubDate>Tue, 13 Jul 2010 19:21:39 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Problem bei Algorythmus on Tue, 13 Jul 2010 18:58:03 GMT]]></title><description><![CDATA[<p>Sprenger120 schrieb:</p>
<blockquote>
<p>Hi,</p>
<p>ich habe gestern versucht das<br />
<a href="http://primzahlen.de/files/theorie/sieb.htm" rel="nofollow">Sieb des Eratosthenes</a> nachzubaun. Aber irgentwie will das ganze nicht so ganz funktionieren.<br />
Hoffentlich könnt ihr mir Helfen !</p>
</blockquote>
<p>Wenn du sagen würdest, was nicht funktioniert ...</p>
<p>Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925795</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 13 Jul 2010 18:58:03 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Problem bei Algorythmus on Tue, 13 Jul 2010 19:04:01 GMT]]></title><description><![CDATA[<pre><code>goto LoopE;
</code></pre>
<p>Ein break hätte es auch getan.</p>
<pre><code>if (Match = false)
</code></pre>
<p>Der Vergleichsoperator ist ==. <code>!Match</code> ist äquivalent zu <code>Match==false</code> .</p>
<p>Nachtrag:<br />
Arraygrößen müssen zur Kompilierzeit bekannte Konstanten sein.<br />
Für</p>
<pre><code class="language-cpp">int aMatch[Zahl];
      int MatchIndex = 0;
</code></pre>
<p>gibt es vector.</p>
<p><code>int ZahlSqrt = sqrt(Zahl);</code> tut's auch und in beiden Fällen musst du noch cmath einbinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925796</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Tue, 13 Jul 2010 19:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to [gelöst] Problem bei Algorythmus on Tue, 13 Jul 2010 19:21:13 GMT]]></title><description><![CDATA[<p>@manni66: Oh sry hatte ich im eifer des Gefechts vergessen :D.<br />
Also der int Array lässt sich nicht deklarieren</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/23889">@Athar</a>: Danke für die Tipps, habs mal abgeändert.</p>
<p>//Edit: Danke vectoren waren das richtige.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925799</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925799</guid><dc:creator><![CDATA[Sprenger120]]></dc:creator><pubDate>Tue, 13 Jul 2010 19:21:13 GMT</pubDate></item></channel></rss>