<?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[Strukturausgabe]]></title><description><![CDATA[<p>Hey Leute ...</p>
<p>Ich soll ein Programm schreiben, welches folgende Struktur als Ausgabe erzeugt, wobei die Strukturgröße durch eine eingegebene Variable verändert werden kann. (Nutzen Sie nicht mehr als zwei Schleifen)</p>
<p>für a=5 :</p>
<p>0<br />
00<br />
000<br />
0000<br />
00000<br />
0000<br />
000<br />
00<br />
0</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
using namespace std;

void func();

int main()

{

 int a;

 cout &lt;&lt; &quot;Geben Sie die Strukturgroesse ein: &quot;;
 cin &gt;&gt; a;

int a;

 while(a&gt;0) 

 {
  cout &lt;&lt; &quot;0&quot; &lt;&lt; endl;
  a=a-1;

 }

 system(&quot;pause&quot;);

}

void func()

{

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/304002/strukturausgabe</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 03:54:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/304002.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 May 2012 18:16:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Strukturausgabe on Sun, 27 May 2012 18:16:09 GMT]]></title><description><![CDATA[<p>Hey Leute ...</p>
<p>Ich soll ein Programm schreiben, welches folgende Struktur als Ausgabe erzeugt, wobei die Strukturgröße durch eine eingegebene Variable verändert werden kann. (Nutzen Sie nicht mehr als zwei Schleifen)</p>
<p>für a=5 :</p>
<p>0<br />
00<br />
000<br />
0000<br />
00000<br />
0000<br />
000<br />
00<br />
0</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
using namespace std;

void func();

int main()

{

 int a;

 cout &lt;&lt; &quot;Geben Sie die Strukturgroesse ein: &quot;;
 cin &gt;&gt; a;

int a;

 while(a&gt;0) 

 {
  cout &lt;&lt; &quot;0&quot; &lt;&lt; endl;
  a=a-1;

 }

 system(&quot;pause&quot;);

}

void func()

{

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2216065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216065</guid><dc:creator><![CDATA[Vanilly]]></dc:creator><pubDate>Sun, 27 May 2012 18:16:09 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Sun, 27 May 2012 18:17:44 GMT]]></title><description><![CDATA[<p>Ich weiß nun aber nicht wirklich weiter <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>Wie kann ich denn immer wieder eine neue 0 mit anhängen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216066</guid><dc:creator><![CDATA[Vanilly]]></dc:creator><pubDate>Sun, 27 May 2012 18:17:44 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 06:46:09 GMT]]></title><description><![CDATA[<p>Lass ein endl weg...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216208</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216208</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 28 May 2012 06:46:09 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 06:46:21 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u100590" rel="nofollow">Martin Richter</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f1" rel="nofollow">MFC (Visual C++)</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (auch C++0x und C++11)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216209</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 28 May 2012 06:46:21 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 07:11:13 GMT]]></title><description><![CDATA[<p>Vanilly schrieb:</p>
<blockquote>
<p>(Nutzen Sie nicht mehr als zwei Schleifen)</p>
</blockquote>
<p>Das ist die sinnlosteste Anforderung, die man sich überhaupt stellen kann. Ausbildung als FI/AE, wenn ich mich nicht irre.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;

int main()
{
    cout&lt;&lt;&quot;Geben Sie die Strukturgroesse ein: &quot;;
    int n;
    cin&gt;&gt;n;
    n=2*n-1;
    for(int i=1;i&lt;n+1;++i){
        for(int j=0;j&lt;i&amp;&amp;j&lt;n+1-i;++j)
            cout&lt;&lt;'0';
        cout&lt;&lt;'\n';
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2216214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216214</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 28 May 2012 07:11:13 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 07:17:33 GMT]]></title><description><![CDATA[<p>Es gibt verschiedene Möglichkeiten das zu lösen, bpsw. so (denkansatz, ungetestet):</p>
<pre><code class="language-cpp">int ct(6);
    for(int a(0);a &lt; ct * 2;++a)
        std::cout &lt;&lt; std::string((a &gt;= ct)? 2 * ct - a : a, '0') &lt;&lt; '\n';
</code></pre>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/106">@volkard</a>: Komm, mit dem Code kannst du nicht beim IOCCC gewinnen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216215</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 28 May 2012 07:17:33 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 09:12:31 GMT]]></title><description><![CDATA[<p>So, alle Schleifen weg. Und sogar hübsch dokumentiert. Und im Aussehen ein wenig an die Vorgabe angepaßt.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;//für cout
#include &lt;cstdlib&gt;//für system()
using namespace std;

void func(int,int);

int main()

{

    int a;//a anlegen

    cout&lt;&lt;&quot;Geben Sie die Strukturgroesse ein: &quot;;
    cin&gt;&gt;a;//Eingabe

    func(a,1),//Ausgabe
    func(a-1,2);//Ausgabe

    system(&quot;pause&quot;);//aus Tastendruck warten

}

void func(int a,int b)

{
    int c;//Hilfsvariable c

    if(!a) return;//Abbruchbedingung

    c=a--;//Zuweisung

    if(b&lt;2) func(a,b);//rekursiver Aufruf

    if(!b) cout&lt;&lt;b;//waagerecht

    if(b&gt;0) func(c,!b),//senkrecht

    cout&lt;&lt;endl;//der notwendige Zeilenumbruch

    if(b&gt;1) func(a,b);//senkrecht

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2216219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216219</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 28 May 2012 09:12:31 GMT</pubDate></item><item><title><![CDATA[Reply to Strukturausgabe on Mon, 28 May 2012 13:55:17 GMT]]></title><description><![CDATA[<p>Ah - endlich mal wieder eine kleine Programmieraufgabe, wenn auch etwas sehr mickrig <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="😉"
    /><br />
Der Input sei a, dann müssen 2a-1 Zeilen ausgegeben werden. Die Anzahl der 0'en hat einen Knick, das erreicht man z.B. mit der Funktion abs.<br />
Wenn die Nummer der Zeile von 1 bis 2a-1 läuft, dann ist die Anzahl der 0'en = a-abs(a-spaltenNr). Lässt man die spaltenNr statt von 1 bis 2a-1 von 1-a bis a-1 laufen, so vereinfacht sich das ganze noch etwas.<br />
Mehrere gleiche Zeichen lassen sich mit setfill und setw ausgeben. Dann ist nur eine Schleife notwendig.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;iomanip&gt; // setw
#include &lt;cmath&gt; // abs

int main()
{
    int a;
    if( cin &gt;&gt; a )
    {
        cout.fill('0');
        for( int spaltenNr = 1-a; spaltenNr &lt; a; ++spaltenNr )
            cout &lt;&lt; setw(a - abs(spaltenNr)) &lt;&lt; '0' &lt;&lt; &quot;\n&quot;;
    }
    cout &lt;&lt; endl; // flush
    return 0;
}
</code></pre>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216313</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Mon, 28 May 2012 13:55:17 GMT</pubDate></item></channel></rss>