<?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[fehler in einer while-schleife]]></title><description><![CDATA[<p>Hallo Leute</p>
<p>ich habe eine schulaufgabe ausprobiert, und bin dabie auf ein Problem gestoßen. meine &quot;while&quot;-schleife scheint nicht zu funktionieren. sobald ich den button drücke, hängt sich das programm auf. Kann mir jemand sagen, wo mien fehler liegt?</p>
<pre><code>//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop
#include &lt;math.h&gt;

#include &quot;spirale_u.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
const int XUrsprung = 300;
const int YUrsprung = 300;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
zf-&gt;Canvas-&gt;MoveTo(XUrsprung, 20);
zf-&gt;Canvas-&gt;LineTo(XUrsprung, 580);
zf-&gt;Canvas-&gt;MoveTo(20, YUrsprung);
zf-&gt;Canvas-&gt;LineTo(580, YUrsprung);
}
//---------------------------------------------------------------------------
void wandlePolarKartesisch(float r, float phi, float &amp;x, float &amp;y)
{
	y = r * sin(phi);
	x = r * cos(phi);
}
//---------------------------------------------------------------------------
void transformiereKoordinaten(float x, float y, int &amp;xP, int &amp;yP)
{
	xP = floor(x + XUrsprung + 0.5);
	yP = floor(y - YUrsprung + 0.5);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnZeichneClick(TObject *Sender)
{
float phi, r, x, y;
int xP, yP;
phi = 0;
while(phi &lt;= 3 * M_PI)
	{
	r = 30 * phi;
	wandlePolarKartesisch(r, phi, x, y);
	transformiereKoordinaten(x, y, xP, yP);
	zf-&gt;Canvas-&gt;Pixels[xP][yP] = clRed;
	phi &lt;- phi + (M_PI/100);
	}
}
</code></pre>
<p>ich kann mir gut vorstellen, dass es ein leichtsinnsfehler ist, aber ich habe jetzt 6wochen ferien gehabt und finde rein gar nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>danke schonmal im vorraus!</p>
<p>Barnibas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/319968/fehler-in-einer-while-schleife</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 16:03:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/319968.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Sep 2013 20:25:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:25:08 GMT]]></title><description><![CDATA[<p>Hallo Leute</p>
<p>ich habe eine schulaufgabe ausprobiert, und bin dabie auf ein Problem gestoßen. meine &quot;while&quot;-schleife scheint nicht zu funktionieren. sobald ich den button drücke, hängt sich das programm auf. Kann mir jemand sagen, wo mien fehler liegt?</p>
<pre><code>//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop
#include &lt;math.h&gt;

#include &quot;spirale_u.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
const int XUrsprung = 300;
const int YUrsprung = 300;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
zf-&gt;Canvas-&gt;MoveTo(XUrsprung, 20);
zf-&gt;Canvas-&gt;LineTo(XUrsprung, 580);
zf-&gt;Canvas-&gt;MoveTo(20, YUrsprung);
zf-&gt;Canvas-&gt;LineTo(580, YUrsprung);
}
//---------------------------------------------------------------------------
void wandlePolarKartesisch(float r, float phi, float &amp;x, float &amp;y)
{
	y = r * sin(phi);
	x = r * cos(phi);
}
//---------------------------------------------------------------------------
void transformiereKoordinaten(float x, float y, int &amp;xP, int &amp;yP)
{
	xP = floor(x + XUrsprung + 0.5);
	yP = floor(y - YUrsprung + 0.5);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnZeichneClick(TObject *Sender)
{
float phi, r, x, y;
int xP, yP;
phi = 0;
while(phi &lt;= 3 * M_PI)
	{
	r = 30 * phi;
	wandlePolarKartesisch(r, phi, x, y);
	transformiereKoordinaten(x, y, xP, yP);
	zf-&gt;Canvas-&gt;Pixels[xP][yP] = clRed;
	phi &lt;- phi + (M_PI/100);
	}
}
</code></pre>
<p>ich kann mir gut vorstellen, dass es ein leichtsinnsfehler ist, aber ich habe jetzt 6wochen ferien gehabt und finde rein gar nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>danke schonmal im vorraus!</p>
<p>Barnibas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351679</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351679</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:25:08 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:28:12 GMT]]></title><description><![CDATA[<blockquote>
<p>phi &lt;- phi + (M_PI/100);</p>
</blockquote>
<p>Sehr kreativ. Soll das eine Zuweisung sein? Dann doch bitte wie gehabt so:</p>
<pre><code>phi = phi + (M_PI/100);
</code></pre>
<p>Was du geschrieben hast ist ein &quot;kleiner als&quot; und ein &quot;minus&quot;. Auch wenn das in manch einer Sprache als Zuweisung benutzt wird, in C++ ist das nicht so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351680</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:28:12 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:30:30 GMT]]></title><description><![CDATA[<p>Wie ist <code>M_PI</code> definiert? Ich nehme mal an, wie Π...</p>
<pre><code>phi &lt;- phi
</code></pre>
<p>Diese Syntax ist sehr verwirrend. Mach das unäre Minus direkt vor <code>phi</code> .</p>
<p>Dann wirst du auch sehen, <strong>warum sich <code>phi</code> nicht verändert</strong>. Du hast einfach einen Ungleichungs-Ausdruck als Statement stehen. Dein Compiler sollte dir da auch eine Warnung geben, etwas wie &quot;warning: statement has no effect&quot;.</p>
<p>~Edit: Bashar, du Bastard! Zu langsam...~ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351681</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:30:30 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:31:40 GMT]]></title><description><![CDATA[<p>wie ich gewusst hab, dass es sowas ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> das kommt daher, dass unser lehrer uns unsere struktogramme immer so machen lässt. ich hab zwar immernoch ienen fehler drin, denn es acht nicht das, was es soll, aber es häng sich nicht mehr auf^^ danke für deine hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351682</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:31:40 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:35:30 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Wie ist <code>M_PI</code> definiert? Ich nehme mal an, wie Π...</p>
</blockquote>
<p>Ich weis nicht, das ist eine Konstante, die in &quot;math.h&quot; enthalten ist.</p>
<p>Sone schrieb:</p>
<blockquote>
<pre><code>phi &lt;- phi
</code></pre>
<p>Diese Syntax ist sehr verwirrend. Mach das unäre Minus direkt vor <code>phi</code> .</p>
<p>Dann wirst du auch sehen, <strong>warum sich <code>phi</code> nicht verändert</strong>. Du hast einfach einen Ungleichungs-Ausdruck als Statement stehen. Dein Compiler sollte dir da auch eine Warnung geben, etwas wie &quot;warning: statement has no effect&quot;.</p>
</blockquote>
<p>Ich versteh nicht ganz, was du mir damit sagen willst, aber eine warnung bekomme ich nicht!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351684</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:35:30 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:38:38 GMT]]></title><description><![CDATA[<blockquote>
<p>Ich versteh nicht ganz, was du mir damit sagen willst</p>
</blockquote>
<p>Dasselbe wie Bashar. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<blockquote>
<p>aber eine warnung bekomme ich nicht!</p>
</blockquote>
<p>Das ist ... ungünstig. Warnungen helfen dir sehr. Welchen Compiler nutzt du? VC++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351685</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:38:38 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 20:41:41 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Das ist ... ungünstig. Warnungen helfen dir sehr. Welchen Compiler nutzt du? VC++?</p>
</blockquote>
<p>wo finde ich das heraus? wenn dir das was sagt: ich benutze &quot;Turbo C++&quot; von &quot;Borland&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351687</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Tue, 10 Sep 2013 20:41:41 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:02:22 GMT]]></title><description><![CDATA[<p>Barnibas schrieb:</p>
<blockquote>
<p>wo finde ich das heraus?</p>
</blockquote>
<p>Im <em>Benutzerhandbuch</em> deines Compilers.</p>
<blockquote>
<p>wenn dir das was sagt: ich benutze &quot;Turbo C++&quot; von &quot;Borland&quot;</p>
</blockquote>
<p>Nun ja, alles was ich finden konnte: Warn-Flags beginnen mit -w. Das nützt auch nicht viel.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351689</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:02:22 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:05:48 GMT]]></title><description><![CDATA[<p>Ich glaube nicht, dass Compilerflags an der Stelle notwendig sind. Klick mal die Einstellungsdialoge durch, bei den Compileroptionen muss es da was zum Thema Warnungen geben. Stell das Warnungslevel so hoch wie möglich, aber nur so hoch, dass du nicht mit Warnungen aus der vcl.h und anderen nicht von dir stammenden Headern erschlagen wirst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351690</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:05:48 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:08:00 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Stell das Warnungslevel so hoch wie möglich, aber nur so hoch, dass du nicht mit Warnungen aus der vcl.h und anderen nicht von dir stammenden Headern erschlagen wirst.</p>
</blockquote>
<p>Dazu sollte man Headersuchpfade mit einem Flag wie <code>-isystem</code> angeben, sodass keine Warnungen dafür generiert werden.<br />
Sollte auch in den Einstellungen liegen, wie Headersuchpfade an den Compiler übergeben werden. Ich lasse alle als Systemverzeichnisse angeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351691</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:08:00 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:12:02 GMT]]></title><description><![CDATA[<p>also laut unserem lehrer, zeigt der turbo c++ alle warnung an, die ich verursachen könnte.....ich glaube, mir wurde nichts angezeigt, weil sich das programm ja aufhängt und ich deswegen nicht auf dem &quot;natürlichen&quot; weg zurück in Turbo c++ gelange.</p>
<p>wie dem auch sei, mein problem ist gelöst und dafür danke ich dir/euch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
gute nacht!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351692</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:12:02 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:19:35 GMT]]></title><description><![CDATA[<p>Barnibas schrieb:</p>
<blockquote>
<p>also laut unserem lehrer, zeigt der turbo c++ alle warnung an, die ich verursachen könnte</p>
</blockquote>
<p>Ich hab vor 20 Jahren schon &quot;Statement has no effect&quot;-Warnungen in Turbo C++ gesehen, glaube nicht, dass die das inzwischen abgeschafft haben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351697</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:19:35 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:27:13 GMT]]></title><description><![CDATA[<p>Du hast also mit 13 Programmieren angefangen? Interessant.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351700</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:27:13 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:25:47 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Du hast also mit 13 Programmieren angefangen? Interessant.</p>
</blockquote>
<p>Nein mit 10, du Logiker.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351703</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:25:47 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:27:08 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<p>Du hast also mit 13 Programmieren angefangen? Interessant.</p>
</blockquote>
<p>Nein mit 10, du Logiker.</p>
</blockquote>
<p>Spätestens mit 13, hätte ich sagen sollen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351705</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Tue, 10 Sep 2013 21:43:56 GMT]]></title><description><![CDATA[<p>Turbo C++ ist ja auch uralter Schrott - kein Wunder dass du keine Warnung bekommst. Selbst eine ordentliche IDE weist dich darauf hin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351710</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351710</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Tue, 10 Sep 2013 21:43:56 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Wed, 11 Sep 2013 15:09:22 GMT]]></title><description><![CDATA[<p>ich hab das nur, weil wir in der schule mit Borland c++ arbeiten und die eben ähnlich aufgebaut sind. außerdem hab ichs dadurch auch kostenlos^^und nem geschenken gaul guckt man nicht ins maul <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351893</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Wed, 11 Sep 2013 15:09:22 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Wed, 11 Sep 2013 15:14:18 GMT]]></title><description><![CDATA[<p>VS ist auch kostenlos und funktioniert wenigstens.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351902</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Wed, 11 Sep 2013 15:14:18 GMT</pubDate></item><item><title><![CDATA[Reply to fehler in einer while-schleife on Wed, 11 Sep 2013 15:40:57 GMT]]></title><description><![CDATA[<p>kannst du mir nen link schicken, wo ich mir das mal angucken kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2351906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2351906</guid><dc:creator><![CDATA[Barnibas]]></dc:creator><pubDate>Wed, 11 Sep 2013 15:40:57 GMT</pubDate></item></channel></rss>