<?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[Hilfe bei Zahlensortierung!]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich komme nicht mehr weiter. Aufgabe aus einem Buch:</p>
<p>Geben Sie drei Zahlen ein, diese sollen in numerischer Reihenfolge sortiert werden. Zum Beispiel: Eingabe: 4 8 1 Ausgabe: 1 4 8.</p>
<p>Mein Code:</p>
<p>#include &quot;../../../std_lib_facilities.h&quot;</p>
<p>int main()<br />
{<br />
cout&lt;&lt;&quot;Geben Sie bitte drei ganze Zahlen getrennt durch Leerzeichen ein und betaetigen sie ENTER:\n&quot;;</p>
<p>int Zahl1;<br />
int Zahl2;<br />
int Zahl3;</p>
<p>cin&gt;&gt;Zahl1&gt;&gt;Zahl2&gt;&gt;Zahl3;</p>
<p>if((Zahl1&gt;Zahl2&amp;&amp;Zahl3))<br />
{</p>
<p>if(Zahl2&gt;3)<br />
cout&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl2&lt;3)<br />
cout&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>if((Zahl2&gt;Zahl1&amp;&amp;Zahl3))<br />
{</p>
<p>if(Zahl1&gt;3)<br />
cout&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl1&lt;3)<br />
cout&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>if((Zahl3&gt;Zahl1&amp;&amp;Zahl2))<br />
{</p>
<p>if(Zahl1&gt;2)<br />
cout&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl1&lt;2)<br />
cout&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>keep_window_open();<br />
}</p>
<p>Wisst ihr, wie man das löst? Mir werden nicht immer die Zahlen richtig sortiert ausgegeben, oder es werden in einem Schlag mehrere if-Anweisungen bestätigt, wodurch mehrere Ausgaben zustande kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318095/hilfe-bei-zahlensortierung</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 14:24:41 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318095.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 Jul 2013 05:20:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe bei Zahlensortierung! on Mon, 01 Jul 2013 05:20:16 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich komme nicht mehr weiter. Aufgabe aus einem Buch:</p>
<p>Geben Sie drei Zahlen ein, diese sollen in numerischer Reihenfolge sortiert werden. Zum Beispiel: Eingabe: 4 8 1 Ausgabe: 1 4 8.</p>
<p>Mein Code:</p>
<p>#include &quot;../../../std_lib_facilities.h&quot;</p>
<p>int main()<br />
{<br />
cout&lt;&lt;&quot;Geben Sie bitte drei ganze Zahlen getrennt durch Leerzeichen ein und betaetigen sie ENTER:\n&quot;;</p>
<p>int Zahl1;<br />
int Zahl2;<br />
int Zahl3;</p>
<p>cin&gt;&gt;Zahl1&gt;&gt;Zahl2&gt;&gt;Zahl3;</p>
<p>if((Zahl1&gt;Zahl2&amp;&amp;Zahl3))<br />
{</p>
<p>if(Zahl2&gt;3)<br />
cout&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl2&lt;3)<br />
cout&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>if((Zahl2&gt;Zahl1&amp;&amp;Zahl3))<br />
{</p>
<p>if(Zahl1&gt;3)<br />
cout&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl1&lt;3)<br />
cout&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>if((Zahl3&gt;Zahl1&amp;&amp;Zahl2))<br />
{</p>
<p>if(Zahl1&gt;2)<br />
cout&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot;\n&quot;;</p>
<p>else if(Zahl1&lt;2)<br />
cout&lt;&lt;Zahl1&lt;&lt;&quot; &quot;&lt;&lt;Zahl2&lt;&lt;&quot; &quot;&lt;&lt;Zahl3&lt;&lt;&quot;\n&quot;;<br />
}</p>
<p>keep_window_open();<br />
}</p>
<p>Wisst ihr, wie man das löst? Mir werden nicht immer die Zahlen richtig sortiert ausgegeben, oder es werden in einem Schlag mehrere if-Anweisungen bestätigt, wodurch mehrere Ausgaben zustande kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335642</guid><dc:creator><![CDATA[Krachi]]></dc:creator><pubDate>Mon, 01 Jul 2013 05:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Zahlensortierung! on Mon, 01 Jul 2013 05:30:01 GMT]]></title><description><![CDATA[<p>WTF <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335643</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335643</guid><dc:creator><![CDATA[crispin kenton]]></dc:creator><pubDate>Mon, 01 Jul 2013 05:30:01 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Zahlensortierung! on Mon, 01 Jul 2013 05:54:33 GMT]]></title><description><![CDATA[<p>crispin kenton schrieb:</p>
<blockquote>
<p>WTF <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
</blockquote>
<p>Habs!</p>
<p>Thread kann gelöscht werden. <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/2335652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335652</guid><dc:creator><![CDATA[Krachi]]></dc:creator><pubDate>Mon, 01 Jul 2013 05:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Zahlensortierung! on Mon, 01 Jul 2013 07:04:08 GMT]]></title><description><![CDATA[<p>Poste doch bitte deine Lösung, möglicherweise gibt´s andere Leute die ein ähnliches Problem haben. Die wüssten wahrscheinlich gern, wie´s geht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335659</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Mon, 01 Jul 2013 07:04:08 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei Zahlensortierung! on Mon, 01 Jul 2013 11:05:34 GMT]]></title><description><![CDATA[<p>Mal abgesehen davon, dass es sehr umständlich geschriebener und unpflegbarer Code ist, macht das hier:</p>
<pre><code>if((Zahl1&gt;Zahl2&amp;&amp;Zahl3)
</code></pre>
<pre><code>if(Zahl2&gt;3)
</code></pre>
<p>keinen wirklichen Sinn zum Lösen der Aufgabe.</p>
<p>Man könnte die Zahlen in ein Array (Vector, ...) einlesen und eine Sortierfunktion benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335708</guid><dc:creator><![CDATA[Boolshit]]></dc:creator><pubDate>Mon, 01 Jul 2013 11:05:34 GMT</pubDate></item></channel></rss>