<?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-Schleifen]]></title><description><![CDATA[<p>Ich habe hier ein kleines Programm geschreiben, bei dem drei for-Schleifen bis 10<br />
hoch zählen. Das Ergbnis wird eine Datei ausgeben. Könnte mir mal jemand an Hand der Datei erklären welche Schleife wie hochzählt...Vielen Dank!</p>
<pre><code class="language-cpp"># include &lt;iostream&gt;
# include &lt;fstream&gt;

using namespace std;

int main()
{
    fstream datei;
    datei.open(&quot;Ergebnis.txt&quot;, ios::out);
    int i;
    int j;
    int k;
    for (i=1; i&lt;=10; i++)
    {
        for(j=1; j&lt;=10; j++)
        {
            for (k=1; k&lt;=10; k++)
            {
                 cout &lt;&lt; i*j*k&lt;&lt; endl;
                 datei&lt;&lt;i*j*k&lt;&lt;endl;
            }
        }  
    }

    datei.close();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/293414/for-schleifen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 08:20:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/293414.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 02 Oct 2011 15:26:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 15:26:22 GMT]]></title><description><![CDATA[<p>Ich habe hier ein kleines Programm geschreiben, bei dem drei for-Schleifen bis 10<br />
hoch zählen. Das Ergbnis wird eine Datei ausgeben. Könnte mir mal jemand an Hand der Datei erklären welche Schleife wie hochzählt...Vielen Dank!</p>
<pre><code class="language-cpp"># include &lt;iostream&gt;
# include &lt;fstream&gt;

using namespace std;

int main()
{
    fstream datei;
    datei.open(&quot;Ergebnis.txt&quot;, ios::out);
    int i;
    int j;
    int k;
    for (i=1; i&lt;=10; i++)
    {
        for(j=1; j&lt;=10; j++)
        {
            for (k=1; k&lt;=10; k++)
            {
                 cout &lt;&lt; i*j*k&lt;&lt; endl;
                 datei&lt;&lt;i*j*k&lt;&lt;endl;
            }
        }  
    }

    datei.close();

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2126274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126274</guid><dc:creator><![CDATA[Reeko25]]></dc:creator><pubDate>Sun, 02 Oct 2011 15:26:22 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 15:31:01 GMT]]></title><description><![CDATA[<p>Ist dir nicht klar, was der Quellcode macht, oder warum brauchst du das &quot;anhand der Ausgabe&quot;? Ist nebenbei ein ziemlich schlechtes Format für die Ausgabe.</p>
<p>Mach lieber</p>
<pre><code class="language-cpp">cout &lt;&lt; i&lt;&lt;&quot; &quot;&lt;&lt;j&lt;&lt;&quot; &quot;&lt;&lt;k&lt;&lt; endl;
</code></pre>
<p>dann verstehst du es sofort <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/2126275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126275</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sun, 02 Oct 2011 15:31:01 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 15:33:33 GMT]]></title><description><![CDATA[<p>das heisst einfach nur dass eine anweisung in dienem fall 10mal ausgeführt wird.</p>
<p>die anweisung bei dir ist wiederum eine schleife die eine innere anweisung 10mal ausführt</p>
<p>und diese innere anweisung wird wiederum auch 10mal ausgeführt und da wird dann etwas berechnet</p>
<p>also 10* 10* 10 sprich 1000 mal wird deine multiplikation ausgerechnet und das ergebnis in eine datei geschrieben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126278</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126278</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 02 Oct 2011 15:33:33 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 15:40:00 GMT]]></title><description><![CDATA[<p>Vielen Dank ist mir klarer geworden!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126282</guid><dc:creator><![CDATA[Reeko25]]></dc:creator><pubDate>Sun, 02 Oct 2011 15:40:00 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:13:56 GMT]]></title><description><![CDATA[<p>Das geht übrigens auch kürzer (nämlich weniger als halb so lang):</p>
<pre><code class="language-cpp">fstream datei(&quot;Ergebnis.txt&quot;); 
    for         (int i=1; i&lt;=10; i++) 
        for     (int j=1; j&lt;=10; j++) 
            for (int k=1; k&lt;=10; k++)
            { 
                 cout &lt;&lt; i*j*k &lt;&lt; endl; 
                 datei&lt;&lt; i*j*k &lt;&lt; endl; 
            }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2126365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126365</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:13:56 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:15:21 GMT]]></title><description><![CDATA[<p>Das geht übrigens auch schöner, nämlich mehr als doppelt so schön.</p>
<blockquote>
<p>[20:05:09] &lt;***&gt; <a href="http://www.c-plusplus.net/forum/293414" rel="nofollow">http://www.c-plusplus.net/forum/293414</a> // siehe letzter Beitrag, kann es sein, dass dieser &quot;Hacker&quot; sich seit Wochen immer mehr blamiert? <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 />
[20:05:16] &lt;Paprikachu&gt; ja<br />
[20:05:37] &lt;Paprikachu&gt; ich versuche ihn die ganze zeit zurechtzuweisen, aber ich bin alleine damit <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="😞"
    /><br />
[20:05:43] &lt;***&gt; Aber auch einfach bei jedem Beitrag! Jedes mal denk ich mir Kopf-&gt;Tisch(); <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 />
[20:05:49] &lt;Paprikachu&gt; jop<br />
[20:05:56] &lt;***&gt; Der ist so dumm, da bin ich zu faul zum schreiben.^^</p>
</blockquote>
<p>Der User möchte nicht mit Namen genannt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126372</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:16:03 GMT]]></title><description><![CDATA[<p>314159265358979 schrieb:</p>
<blockquote>
<p>Das geht übrigens auch schöner, nämich doppelt so schön.</p>
</blockquote>
<p>Es ist erstaunlich, daß ausgerechnet du dich darüber aufregst, wenn jemand auf RAII und lokale Variablendefinitionen hinweist.</p>
<p>(PS: Vielleicht kannst du ja &quot;***&quot; überreden dich offen zu unterstützen, wenn du Probleme damit hast daß du alleine dastehst <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="😃"
    /> (aber andererseits bist du ja genausogut darin, dich zu blamieren :D))</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126378</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:16:03 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:53:55 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Es ist erstaunlich, daß ausgerechnet du dich darüber aufregst, wenn jemand auf RAII und lokale Variablendefinitionen hinweist.</p>
</blockquote>
<p>Im Endeffekt hat er aber nur auf &quot;das geht auch kürzer&quot; hingewiesen. Damit ist dem TE wohl nicht sonderlich geholfen.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

int main()
{
    ofstream datei(&quot;Ergebnis.txt&quot;); // Wir öffnen die Datei im Konstruktor
    for (int i = 1; i &lt;= 10; i++) // Ein paar Leerzeichen schaden nicht, aber wichtiger ist das lokale definieren der Variablen.
    {
        for (int j = 1; j &lt;= 10; j++)
        {
            for (int k = 1; k &lt;= 10; k++)
            {
                 cout &lt;&lt; i * j * k &lt;&lt; endl;
                 datei &lt;&lt; i * j * k &lt;&lt; endl;
            }
        }
    }
    // return 0 ist default, kann man aber trotzdem hinschreiben.
} // RAII schließt die Datei automatisch beim verlassen des Scopes
</code></pre>
<p>Sieht doch gleich ganz anders aus, aber oh nein, wir haben nicht genug Zeilen gespart. <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="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126379</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126379</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:53:55 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:51:42 GMT]]></title><description><![CDATA[<p>Hacker schrieb:</p>
<blockquote>
<p>Das geht übrigens auch kürzer (nämlich weniger als halb so lang):</p>
<pre><code class="language-cpp">fstream datei(&quot;Ergebnis.txt&quot;); 
    for         (int i=1; i&lt;=10; i++) 
        for     (int j=1; j&lt;=10; j++) 
            for (int k=1; k&lt;=10; k++)
            { 
                 cout &lt;&lt; i*j*k &lt;&lt; endl; 
                 datei&lt;&lt; i*j*k &lt;&lt; endl; 
            }
</code></pre>
</blockquote>
<p>Wow, das ist genial. Du solltest dich in MasterHacker umbennenen und dir die dämlichste Formatierung aller Zeiten patentieren lassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126386</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:51:42 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:54:58 GMT]]></title><description><![CDATA[<p>ich glaub Mister &quot;***&quot; ist gefunden, jedenfalls von der anzahl der buchstaben würde es passen <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="😃"
    /></p>
<p>herrlich son kindergarten mit erwachsenen (oder fast erwachsenen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126389</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:54:58 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 18:55:58 GMT]]></title><description><![CDATA[<p>Muss dich leider enttäuschen, EOP != ***.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126391</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Sun, 02 Oct 2011 18:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to for-Schleifen on Sun, 02 Oct 2011 19:30:38 GMT]]></title><description><![CDATA[<p>314159265358979 schrieb:</p>
<blockquote>
<p>Muss dich leider enttäuschen, EOP != ***.</p>
</blockquote>
<p>LOL, ich bin's nicht.</p>
<p>&quot;***&quot; kann auch reine Schreibfaulheit von 314159265358979 bedeuten:<br />
Er war einfach zu faul 10 Sternchen einzufügen und hat sich mit drei begnügt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2126394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2126394</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 02 Oct 2011 19:30:38 GMT</pubDate></item></channel></rss>