<?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[drei integer Zahlen sortiren]]></title><description><![CDATA[<p>Es läuft.</p>
<p>Aufgabe und Vorgaben: Schreiben sie ein Programm das den Benutzer<br />
auffordert, drei Integer-Werte einzugeben, und dann die Werte in numerischer Reihenfolge getrennt durch Komma ausgibt aber nur mit Operatoren !<br />
Mit Copy &amp; Paste und trial and error zur Lösung zukommen ist nicht der beste Weg, hat mir aber trotzdem geholfen.<br />
Doch gefallen tut mir der Code nicht, es sieht so zusammen geschustert aus.<br />
Die Lösung für doppelte Zahleneingabe verstehe ich schon aber glücklich bin ich damit nicht.<br />
Geht es besser; bei der Aufgabenstellung ?<br />
Dank für die Hilfe</p>
<pre><code>#include&lt;iostream&gt;
using namespace std;

int main()
{
    cout &lt;&lt; &quot;Bitte geben Sie drei int - Zahle ein \n&quot; ;
    int a,b,c;
    cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;

    if (a &gt; b || a==b)
        {
            if (a &gt; c|| a==c)
            {
                if (b &gt; c|| b==c)
                    {
                        cout &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt;'\n';
                    }
                if (c &gt; b)
                    {
                        cout &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                    }
            }

            if (c &gt; a)
                {
                    cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                }
        }

        else
            if (b &gt; a|| b==a)
            {
                if (b &gt; c|| b==c)
                {
                    if (a &gt; c)
                        {
                            cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt;'\n';
                        }
                    if (c &gt; a|| c==a)
                        {
                            cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                        }
                }
                if (c &gt; b)
                    {
                        cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                    }
            }

        else
            if (c &gt; a)
            {
                if (c &gt; b)
                    {
                        if (a &gt; b)
                            {
                                cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                            }
                        if (b &gt; a)
                            {
                                cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                            }
                    }
                if (b &gt; c)
                    {
                        cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                    }
            }

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/328172/drei-integer-zahlen-sortiren</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 16:09:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/328172.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 26 Sep 2014 08:06:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:06:22 GMT]]></title><description><![CDATA[<p>Es läuft.</p>
<p>Aufgabe und Vorgaben: Schreiben sie ein Programm das den Benutzer<br />
auffordert, drei Integer-Werte einzugeben, und dann die Werte in numerischer Reihenfolge getrennt durch Komma ausgibt aber nur mit Operatoren !<br />
Mit Copy &amp; Paste und trial and error zur Lösung zukommen ist nicht der beste Weg, hat mir aber trotzdem geholfen.<br />
Doch gefallen tut mir der Code nicht, es sieht so zusammen geschustert aus.<br />
Die Lösung für doppelte Zahleneingabe verstehe ich schon aber glücklich bin ich damit nicht.<br />
Geht es besser; bei der Aufgabenstellung ?<br />
Dank für die Hilfe</p>
<pre><code>#include&lt;iostream&gt;
using namespace std;

int main()
{
    cout &lt;&lt; &quot;Bitte geben Sie drei int - Zahle ein \n&quot; ;
    int a,b,c;
    cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;

    if (a &gt; b || a==b)
        {
            if (a &gt; c|| a==c)
            {
                if (b &gt; c|| b==c)
                    {
                        cout &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt;'\n';
                    }
                if (c &gt; b)
                    {
                        cout &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                    }
            }

            if (c &gt; a)
                {
                    cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                }
        }

        else
            if (b &gt; a|| b==a)
            {
                if (b &gt; c|| b==c)
                {
                    if (a &gt; c)
                        {
                            cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt;'\n';
                        }
                    if (c &gt; a|| c==a)
                        {
                            cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                        }
                }
                if (c &gt; b)
                    {
                        cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                    }
            }

        else
            if (c &gt; a)
            {
                if (c &gt; b)
                    {
                        if (a &gt; b)
                            {
                                cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt;'\n';
                            }
                        if (b &gt; a)
                            {
                                cout &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                            }
                    }
                if (b &gt; c)
                    {
                        cout &lt;&lt; b &lt;&lt; &quot; , &quot; &lt;&lt; c &lt;&lt; &quot; , &quot; &lt;&lt; a &lt;&lt;'\n';
                    }
            }

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2419300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419300</guid><dc:creator><![CDATA[juhu123]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:06:22 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:18:35 GMT]]></title><description><![CDATA[<p>Willst Du uns verarschen oder leidest Du unter Alzheimer?</p>
<p><a href="http://www.c-plusplus.net/forum/328036" rel="nofollow">http://www.c-plusplus.net/forum/328036</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419306</guid><dc:creator><![CDATA[mgaeckler]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:18:35 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:27:32 GMT]]></title><description><![CDATA[<p>mgaeckler schrieb:</p>
<blockquote>
<p>Willst Du uns verarschen oder leidest Du unter Alzheimer?</p>
<p><a href="http://www.c-plusplus.net/forum/328036" rel="nofollow">http://www.c-plusplus.net/forum/328036</a></p>
</blockquote>
<p>Wenn ich mir den verlinkten Thread ansehe, war der wirklich nicht sonderlich hilfreich. Das liegt natürlich an der Fragestellung, die sehr zu trolligen Antworten verleitet, weil sie gegen <a href="http://www.c-plusplus.net/forum/200753" rel="nofollow">jede Netiquette verstößt</a>.</p>
<p>Ich vermute, dieser Thread wird ähnlich enden, ich lass ihn aber trotzdem vorerst offen. Im schlimmsten Fall wird's amüsant. Aber ansonsten fühle ich mich nicht sonderlich motiviert, eine Antwort auf die Frage zu geben, wenn der Fragesteller so vor sich hin stammelt, das man jeden zweiten Satz nicht verstehen kann. Bloß noch die obligatorische, mathematisch korrekte Antwort:</p>
<p>juhu123 schrieb:</p>
<blockquote>
<p>Geht es besser; bei der Aufgabenstellung ?</p>
</blockquote>
<p>Ja. Sehr sogar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419309</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:30:00 GMT]]></title><description><![CDATA[<p>juhu123 schrieb:</p>
<blockquote>
<p>Geht es besser; bei der Aufgabenstellung?</p>
</blockquote>
<p>Weiß nicht. Was heißt da &quot;aber nur mit Operatoren&quot;?</p>
<p>Zunächst mal gibt es nur 6 mögliche Reihenfolgen. Also müßten auch 6 Fälle im Code reichen, Du hast deren aber 9.</p>
<pre><code>#include&lt;iostream&gt;
using namespace std;

int main(){
    cout &lt;&lt; &quot;Bitte geben Sie drei int - Zahle ein \n&quot; ;
    int a,b,c;
    cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;

	if(a&lt;=b){
		if(a&lt;=c){
			cout&lt;&lt;a&lt;&lt;' ';
			if(b&lt;=c)
				cout&lt;&lt;b&lt;&lt;' '&lt;&lt;c;
			else
				cout&lt;&lt;c&lt;&lt;' '&lt;&lt;b;
		}
		else//c&lt;=a
			cout&lt;&lt;c&lt;&lt;' '&lt;&lt;a&lt;&lt;' '&lt;&lt;b;
	}
	else{//b&lt;=a
		if(b&lt;=c){
			cout&lt;&lt;b&lt;&lt;' ';
			if(a&lt;=c)
				cout&lt;&lt;a&lt;&lt;' '&lt;&lt;c;
			else
				cout&lt;&lt;c&lt;&lt;' '&lt;&lt;a;
		}
		else//c&lt;=b
			cout&lt;&lt;c&lt;&lt;' '&lt;&lt;b&lt;&lt;' '&lt;&lt;a;
	}
	cout&lt;&lt;'\n';
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2419313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419313</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:30:00 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:30:44 GMT]]></title><description><![CDATA[<p>Bashar hat Dir in dem anderen Thread schon gesagt: zeichne Dir einen &quot;Entscheidungsbaum&quot; auf.<br />
Also eine Entscheidung oben und dann nach links und nach rechts, wenn die Bedingung wahr bzw. falsch ist. Dann die nächste Entscheidung usw.</p>
<p>Die Aufgabe hat weniger mit programmieren zu tun, als vielmehr mit Logik.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419314</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:30:44 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:34:43 GMT]]></title><description><![CDATA[<p>Furble Wurble schrieb:</p>
<blockquote>
<p>Die Aufgabe hat weniger mit programmieren zu tun, als vielmehr mit Logik.</p>
</blockquote>
<p>Wenn du dir Aufgabe verstanden hast, dann erklär mal bitte. Ich kann mit dem Operatorgefasel in beiden Threads nichts anfangen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419317</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419317</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:34:43 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:36:02 GMT]]></title><description><![CDATA[<p>Ah, nur mit Operatoren wird wohl das hier sein.</p>
<pre><code>#include&lt;iostream&gt;
using namespace std;

int main(){
    cout &lt;&lt; &quot;Bitte geben Sie drei int - Zahle ein \n&quot; ;
    int a,b,c;
    cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;

	(a&lt;=b?(a&lt;=c?cout&lt;&lt;a&lt;&lt;' ',(b&lt;=c?cout&lt;&lt;b&lt;&lt;' '&lt;&lt;c:cout&lt;&lt;c&lt;&lt;' '&lt;&lt;b):cout&lt;&lt;c&lt;&lt;' '&lt;&lt;a&lt;&lt;' '&lt;&lt;b):(b&lt;=c?cout&lt;&lt;b&lt;&lt;' ',(a&lt;=c?cout&lt;&lt;a&lt;&lt;' '&lt;&lt;c:cout&lt;&lt;c&lt;&lt;' '&lt;&lt;a):cout&lt;&lt;c&lt;&lt;' '&lt;&lt;b&lt;&lt;' '&lt;&lt;a))&lt;&lt;'\n';
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2419319</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419319</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:36:02 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 08:41:54 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Furble Wurble schrieb:</p>
<blockquote>
<p>Die Aufgabe hat weniger mit programmieren zu tun, als vielmehr mit Logik.</p>
</blockquote>
<p>Wenn du dir Aufgabe verstanden hast, dann erklär mal bitte. Ich kann mit dem Operatorgefasel in beiden Threads nichts anfangen.</p>
</blockquote>
<p>Das Operatorgefasel: keine Ahnung. <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>
<p>Im Buch allerdings ist das in Kapitel 3, noch vor Funktionen.<br />
Bis dahin gibt es <code>if/else</code> und <code>cout</code> .</p>
<p>Volkards Lösung (die erste in diesem Thread) ist - denke ich - so ziemlich das, was Stroustrup im Sinn hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419324</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Fri, 26 Sep 2014 08:41:54 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 09:11:44 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>mgaeckler schrieb:</p>
<blockquote>
<p>Willst Du uns verarschen oder leidest Du unter Alzheimer?</p>
<p><a href="http://www.c-plusplus.net/forum/328036" rel="nofollow">http://www.c-plusplus.net/forum/328036</a></p>
</blockquote>
<p>Wenn ich mir den verlinkten Thread ansehe, war der wirklich nicht sonderlich hilfreich. Das liegt natürlich an der Fragestellung, die sehr zu trolligen Antworten verleitet, weil sie gegen <a href="http://www.c-plusplus.net/forum/200753" rel="nofollow">jede Netiquette verstößt</a>.</p>
</blockquote>
<p>Dort wurden aber Lösungen geboten:</p>
<p><a href="http://www.c-plusplus.net/forum/p2418206#2418206" rel="nofollow">http://www.c-plusplus.net/forum/p2418206#2418206</a></p>
<p>Und wenn er keine Funktionen aufrufen darf, kann man den Tausch auch leicht anders machen:</p>
<pre><code>int a, b, c, tmp;

...

if( a &gt; b )
{
    tmp = a; a = b; b = tmp;
}
</code></pre>
<p>mfg Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419331</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419331</guid><dc:creator><![CDATA[mgaeckler]]></dc:creator><pubDate>Fri, 26 Sep 2014 09:11:44 GMT</pubDate></item><item><title><![CDATA[Reply to drei integer Zahlen sortiren on Fri, 26 Sep 2014 09:28:43 GMT]]></title><description><![CDATA[<p>Danke<br />
Problem gelöst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2419338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2419338</guid><dc:creator><![CDATA[juhu123]]></dc:creator><pubDate>Fri, 26 Sep 2014 09:28:43 GMT</pubDate></item></channel></rss>