<?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[Apfelmänchen  Problem?]]></title><description><![CDATA[<p>Habe ein Problem mit dem Algorithmus, könntet ihr mal kontrollieren was daran falsch ist.</p>
<pre><code>void CChildView::OnPaint() 
{
	CPaintDC dc(this); // Gerätekontext zum Zeichnen
	double x1,y1,x2,y2;
	double px,py;
	double abs2;
    int i,j,iter;
	iter = 0;

	int length_x,length_y;

	CRect MyRect;

	GetClientRect(MyRect);
    length_x = MyRect.right;
	length_y = MyRect.bottom;

	for (i = 0; i &lt; length_x; i++)
	{
		for(j = 0; j &lt; length_y; j++)
		{
         px = (i-length_x/2)*100.0;
		 py = (j-length_x/2)*100.0;

		 x2   = 0.0;
		 y2   = 0.0;
		 abs2 = 0.0;
		 while(abs2 &lt;=4.0 &amp;&amp; iter &lt; 50)
		 {
           x1 = x2;
		   y1 = y2;
		   x2 = x1  * x1 - y1 * y1 + px;
		   y2 = 2.0 * x1 * y1 + py;

		   abs2 = x2 * x2 + y2 * y2;
		   iter++;
		 }

			if(abs2 &lt;= 4.0)
			{
			 dc.MoveTo(i,j);
			 dc.LineTo(i+1,j);
			}
		}
	}

	// TODO: Fügen Sie hier Ihren Nachrichtenbehandlungscode ein.

	// Rufen Sie nicht CWnd::OnPaint() für Nachrichten zum Zeichnen auf
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/149622/apfelmänchen-problem</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 21:11:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/149622.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Jun 2006 19:46:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Apfelmänchen  Problem? on Wed, 07 Jun 2006 19:46:28 GMT]]></title><description><![CDATA[<p>Habe ein Problem mit dem Algorithmus, könntet ihr mal kontrollieren was daran falsch ist.</p>
<pre><code>void CChildView::OnPaint() 
{
	CPaintDC dc(this); // Gerätekontext zum Zeichnen
	double x1,y1,x2,y2;
	double px,py;
	double abs2;
    int i,j,iter;
	iter = 0;

	int length_x,length_y;

	CRect MyRect;

	GetClientRect(MyRect);
    length_x = MyRect.right;
	length_y = MyRect.bottom;

	for (i = 0; i &lt; length_x; i++)
	{
		for(j = 0; j &lt; length_y; j++)
		{
         px = (i-length_x/2)*100.0;
		 py = (j-length_x/2)*100.0;

		 x2   = 0.0;
		 y2   = 0.0;
		 abs2 = 0.0;
		 while(abs2 &lt;=4.0 &amp;&amp; iter &lt; 50)
		 {
           x1 = x2;
		   y1 = y2;
		   x2 = x1  * x1 - y1 * y1 + px;
		   y2 = 2.0 * x1 * y1 + py;

		   abs2 = x2 * x2 + y2 * y2;
		   iter++;
		 }

			if(abs2 &lt;= 4.0)
			{
			 dc.MoveTo(i,j);
			 dc.LineTo(i+1,j);
			}
		}
	}

	// TODO: Fügen Sie hier Ihren Nachrichtenbehandlungscode ein.

	// Rufen Sie nicht CWnd::OnPaint() für Nachrichten zum Zeichnen auf
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1073431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073431</guid><dc:creator><![CDATA[Apfel]]></dc:creator><pubDate>Wed, 07 Jun 2006 19:46:28 GMT</pubDate></item><item><title><![CDATA[Reply to Apfelmänchen  Problem? on Thu, 08 Jun 2006 07:04:57 GMT]]></title><description><![CDATA[<p>Gegenfrage: Worüber beschwert sich denn dein Compiler?</p>
<p>Ein Fehler ist mir schon aufgefallen: Du solltest vor der while()-Schleife ein &quot;iter=0&quot; einsetzen, sonst rechnet er die Schleife nur für die obere linke Ecke durch (je nach benötigter Schrittzahl auch für die nächsten Punkte).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073591</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 08 Jun 2006 07:04:57 GMT</pubDate></item><item><title><![CDATA[Reply to Apfelmänchen  Problem? on Thu, 08 Jun 2006 07:15:57 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Gegenfrage: Worüber beschwert sich denn dein Compiler?</p>
<p>Ein Fehler ist mir schon aufgefallen: Du solltest vor der while()-Schleife ein &quot;iter=0&quot; einsetzen, sonst rechnet er die Schleife nur für die obere linke Ecke durch (je nach benötigter Schrittzahl auch für die nächsten Punkte).</p>
</blockquote>
<p>Sein iter ist doch null. Hat er gleich nach der Deklaration null gesetzt und bis dahin wirds nicht anders verwendet.<br />
Aber was sagt der Compiler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073596</guid><dc:creator><![CDATA[AndyDD]]></dc:creator><pubDate>Thu, 08 Jun 2006 07:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to Apfelmänchen  Problem? on Thu, 08 Jun 2006 08:01:42 GMT]]></title><description><![CDATA[<p>Ja, am Anfang des ersten Schleifendurchlaufs (i=0,j=0) steht iter auf 0. Aber im Inneren der while()-Schleife wird es ständig weiter hochgezählt, also steht es spätestens nach 50 Läufen auf 50 - und ab da wird die while()-Schleife nicht mehr gestartet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073632</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 08 Jun 2006 08:01:42 GMT</pubDate></item><item><title><![CDATA[Reply to Apfelmänchen  Problem? on Thu, 08 Jun 2006 10:00:49 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Ja, am Anfang des ersten Schleifendurchlaufs (i=0,j=0) steht iter auf 0. Aber im Inneren der while()-Schleife wird es ständig weiter hochgezählt, also steht es spätestens nach 50 Läufen auf 50 - und ab da wird die while()-Schleife nicht mehr gestartet.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
stimmt, hatte ich übersehen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073722</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073722</guid><dc:creator><![CDATA[AndyDD]]></dc:creator><pubDate>Thu, 08 Jun 2006 10:00:49 GMT</pubDate></item></channel></rss>