<?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>hallo ich soll in einem java programm mittels for-schleifen folgende ausgaben erzeugen: (wenn ich es richtig verstanden habe)<br />
da ich c++ schon besser beherrsche habe ich es hierhin gepostet da es in c++ identsich aussieht<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
Abbildung 2: Variante 1: Nullmatrix<br />
0<br />
0 0<br />
0 0 0<br />
0 0 0 0<br />
0 0 0 0 0<br />
Abbildung 3: Variante 2: linke untere Dreiecksmatrix<br />
0 0 0 0 0<br />
0 0 0 0<br />
0 0 0<br />
0 0<br />
0<br />
Abbildung 4:</p>
<p>dies soll mittels zweier for-schleifen geschehen der anwesung break und continue<br />
nunja lösung habe ich bereits:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

void printDefaultMatrix();
void printLeftUpperMatrix();
void printRightLowerMatrix();

int main()
{
    printDefaultMatrix();
    cout &lt;&lt; endl;
    printLeftUpperMatrix();
    cout &lt;&lt; endl;
    printRightLowerMatrix();
}

void printDefaultMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=0; j&lt;5; j++)
        {
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}

void printLeftUpperMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=1; j&lt;=5; j++)
        {
            if( j&lt;=i)
                continue;
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}

void printRightLowerMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=1; j&lt;=5; j++)
        {
            if( j&lt;=i)
                continue;
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}
</code></pre>
<p>meine frage wieso funktioniert das so??<br />
ich habs eher experimentell bestimmt die mit 25 nullen war kein problem aber der rest war eher so: ich geb ein und schau was passiert</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/228378/for-schleifen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 15:29:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228378.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Nov 2008 14:10:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to for-schleifen on Thu, 27 Nov 2008 14:10:21 GMT]]></title><description><![CDATA[<p>hallo ich soll in einem java programm mittels for-schleifen folgende ausgaben erzeugen: (wenn ich es richtig verstanden habe)<br />
da ich c++ schon besser beherrsche habe ich es hierhin gepostet da es in c++ identsich aussieht<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
0 0 0 0 0<br />
Abbildung 2: Variante 1: Nullmatrix<br />
0<br />
0 0<br />
0 0 0<br />
0 0 0 0<br />
0 0 0 0 0<br />
Abbildung 3: Variante 2: linke untere Dreiecksmatrix<br />
0 0 0 0 0<br />
0 0 0 0<br />
0 0 0<br />
0 0<br />
0<br />
Abbildung 4:</p>
<p>dies soll mittels zweier for-schleifen geschehen der anwesung break und continue<br />
nunja lösung habe ich bereits:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

void printDefaultMatrix();
void printLeftUpperMatrix();
void printRightLowerMatrix();

int main()
{
    printDefaultMatrix();
    cout &lt;&lt; endl;
    printLeftUpperMatrix();
    cout &lt;&lt; endl;
    printRightLowerMatrix();
}

void printDefaultMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=0; j&lt;5; j++)
        {
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}

void printLeftUpperMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=1; j&lt;=5; j++)
        {
            if( j&lt;=i)
                continue;
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}

void printRightLowerMatrix()
{
    int i,j;

    for(i=0; i&lt;5; i++)
    {
        for(j=1; j&lt;=5; j++)
        {
            if( j&lt;=i)
                continue;
            cout &lt;&lt; &quot;0 &quot;;
        }
        cout &lt;&lt; endl;
    }
}
</code></pre>
<p>meine frage wieso funktioniert das so??<br />
ich habs eher experimentell bestimmt die mit 25 nullen war kein problem aber der rest war eher so: ich geb ein und schau was passiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621828</guid><dc:creator><![CDATA[gasst]]></dc:creator><pubDate>Thu, 27 Nov 2008 14:10:21 GMT</pubDate></item><item><title><![CDATA[Reply to for-schleifen on Thu, 27 Nov 2008 14:34:37 GMT]]></title><description><![CDATA[<p>Spezifizier mal deine Frage!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1621853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1621853</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Thu, 27 Nov 2008 14:34:37 GMT</pubDate></item></channel></rss>