<?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[for Schleife]]></title><description><![CDATA[<p>Morgen ich hab ein Problem mit diesem Zähler.</p>
<p>Ist es möglich das wenn der counter bei 0 ist</p>
<p>das die zweite letzde Zeile ausgeführt wird?</p>
<p>Also die Zeile</p>
<pre><code class="language-cpp">cout&lt;&lt;&quot;Counter ende\n&quot;;
</code></pre>
<p>Ich weiss halt nicht wie ich aus der Schleife raus kommen kann außer mit goto aber das soll man ja möglichst vermeiden ....</p>
<pre><code class="language-cpp">#include &lt;windows&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{

        for (int i=10 ; i&lt;11 ;i--)
        {
        Sleep(100);
        cout&lt;&lt;i&lt;&lt;&quot;\n&quot;;

                if (i==0)
                {

                }

        }

cout&lt;&lt;&quot;Counter ende\n&quot;;

return 0;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/223876/for-schleife</link><generator>RSS for Node</generator><lastBuildDate>Sat, 03 Oct 2026 12:53:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/223876.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Oct 2008 07:02:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:02:35 GMT]]></title><description><![CDATA[<p>Morgen ich hab ein Problem mit diesem Zähler.</p>
<p>Ist es möglich das wenn der counter bei 0 ist</p>
<p>das die zweite letzde Zeile ausgeführt wird?</p>
<p>Also die Zeile</p>
<pre><code class="language-cpp">cout&lt;&lt;&quot;Counter ende\n&quot;;
</code></pre>
<p>Ich weiss halt nicht wie ich aus der Schleife raus kommen kann außer mit goto aber das soll man ja möglichst vermeiden ....</p>
<pre><code class="language-cpp">#include &lt;windows&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{

        for (int i=10 ; i&lt;11 ;i--)
        {
        Sleep(100);
        cout&lt;&lt;i&lt;&lt;&quot;\n&quot;;

                if (i==0)
                {

                }

        }

cout&lt;&lt;&quot;Counter ende\n&quot;;

return 0;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1591867</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591867</guid><dc:creator><![CDATA[schleife]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:02:35 GMT</pubDate></item><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:06:43 GMT]]></title><description><![CDATA[<p>Du kannst die jeweils innerste Schleife mit</p>
<pre><code class="language-cpp">break;
</code></pre>
<p>verlassen. In deinem Fall ist das aber gar nicht nötig, denn deine Schleifenbedingung ist Mist. Wenn i bei 10 anfängt und in jedem Schritt <strong>kleiner</strong> wird, dann ist die Schleifenbedingung i&lt;11, die also zur Abbruchbedingung i&gt;=11 führt, nicht sinnvoll, weil sie zu einer Endlosschleife führt. Mach doch einfach als Schleifenbedingung i&gt;=0.</p>
<p>Felix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1591871</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591871</guid><dc:creator><![CDATA[Phoemuex]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:06:43 GMT</pubDate></item><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:07:10 GMT]]></title><description><![CDATA[<p>schleife schrieb:</p>
<blockquote>
<p>Ist es möglich das wenn der counter bei 0 ist</p>
<p>das die zweite letzde Zeile ausgeführt wird?</p>
</blockquote>
<p>Warum änderst du die Schleifenbedingung nicht einfach so ab, dass das automatisch passiert (i&gt;0)? Deine jetzige Schleifenbedingung ist komplett sinnlos.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1591872</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591872</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:07:10 GMT</pubDate></item><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:08:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">for ( int i = 10; i &gt;= 0; --i )
{
    std::cout &lt;&lt; i &lt;&lt; std::endl;
}

std::cout &lt;&lt; &quot;Counter Ende&quot; &lt;&lt; std::endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1591875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591875</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:08:04 GMT</pubDate></item><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:33:18 GMT]]></title><description><![CDATA[<p>Danke das mit dem break; funktioniert Perfekt.</p>
<p>Ich weiss das die Schleife sinnlos war aber es ging halt nur darum wie man die verlässt. ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1591884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591884</guid><dc:creator><![CDATA[schleife]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:33:18 GMT</pubDate></item><item><title><![CDATA[Reply to for Schleife on Thu, 02 Oct 2008 07:37:29 GMT]]></title><description><![CDATA[<p>schleife schrieb:</p>
<blockquote>
<p>Danke das mit dem break; funktioniert Perfekt.</p>
</blockquote>
<p>Mist, hätte ich das mal nicht gepostet... In deinem Fall ist es <strong>wesentlich</strong> sinnvoller, die Schleifenbedingung zu ändern. Es sei denn, du wolltest nur wissen, wie man das macht, es aber nicht in <strong>diesem</strong> Fall anwenden.</p>
<p>Felix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1591887</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1591887</guid><dc:creator><![CDATA[Phoemuex]]></dc:creator><pubDate>Thu, 02 Oct 2008 07:37:29 GMT</pubDate></item></channel></rss>