<?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[Funktionsfrage in C++]]></title><description><![CDATA[<p>tschuldigung hat einer ne ahnung wie ich 3 ganze Zahlen in absteigender Reihenfolge sortiere?Also wie die Funktion lautet nachdem ich 3 ganze Zahlen eingegeben habe,um sie später dann nach der Größe auszugeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/225133/funktionsfrage-in-c</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 18:09:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/225133.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Oct 2008 01:34:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 01:34:30 GMT]]></title><description><![CDATA[<p>tschuldigung hat einer ne ahnung wie ich 3 ganze Zahlen in absteigender Reihenfolge sortiere?Also wie die Funktion lautet nachdem ich 3 ganze Zahlen eingegeben habe,um sie später dann nach der Größe auszugeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601459</guid><dc:creator><![CDATA[Bumsfidel]]></dc:creator><pubDate>Mon, 20 Oct 2008 01:34:30 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 04:53:24 GMT]]></title><description><![CDATA[<p>kommt drauf an wie du sie gespeichert hast.<br />
wenn sie in einem Array oder vector sind kannst du mit std::sort das Ganze sortieren. Wenn du sie in ein Set gepackt hast kannst du einfach drüber iterieren, da sie im Set schon sortiert sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601464</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 20 Oct 2008 04:53:24 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 04:56:34 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/algorithm/sort.html" rel="nofollow">http://www.cplusplus.com/reference/algorithm/sort.html</a></p>
<p>Das ist die Referenz zu std::sort, das Beispiel ist auch gleich mit Zahlen, also kannst dir das mal genauer anschauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601465</guid><dc:creator><![CDATA[JustSomeCoder]]></dc:creator><pubDate>Mon, 20 Oct 2008 04:56:34 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 07:02:38 GMT]]></title><description><![CDATA[<p>Wenn die erste kleiner als die zweite ist, vertauschen.<br />
Wenn die zweite kleiner als die dritte ist, vertauschen.<br />
Wenn die erste kleiner als die zweite ist, vertauschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601490</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601490</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 20 Oct 2008 07:02:38 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 16:34:17 GMT]]></title><description><![CDATA[<p>Hab es versucht(bin noch ein echter Anfänger),hab aber irgendwo einen Fehler drin.<br />
Kriege am Ende nur die 3 mal die gleiche Zahl ausgegeben.<br />
Will es erstmal nur sehr einfach halten, ohne sort und array usw.<br />
Guckt mal bitte einer woran es liegt?</p>
<p>#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
int a, b, c;</p>
<p>cout &lt;&lt; &quot; Bitte geben Sie eine ganze Zahl ein: &quot;;<br />
cin &gt;&gt; a;<br />
cout &lt;&lt; &quot; Bitte noch eine andere ganze Zahl eingeben: &quot;;<br />
cin &gt;&gt; b;<br />
cout &lt;&lt; &quot; Und bitte noch eine andere ganze Zahl eingeben: &quot;;<br />
cin &gt;&gt; c;<br />
if (a &lt; b) b = a;<br />
else a = a, b = b;<br />
if (b &lt; c) c = b;<br />
else b = b, c = c;<br />
if (a &lt; b) b = a;<br />
else a = a, b = b;<br />
cout &lt;&lt; a &lt;&lt; &quot;:&quot; &lt;&lt; b &lt;&lt; &quot;:&quot; &lt;&lt; c ;</p>
<p>system(&quot;PAUSE&quot;);<br />
return 0;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601814</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601814</guid><dc:creator><![CDATA[Bumsfidel]]></dc:creator><pubDate>Mon, 20 Oct 2008 16:34:17 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 17:23:29 GMT]]></title><description><![CDATA[<p>Als kleinen Denkanstoß zeige ich dir mal wie man mit simplen Mitteln 2 Zahlen absteigend sortieren könnte:</p>
<pre><code class="language-cpp">//main.cpp
#include &lt;iostream&gt;
using std::cout;
using std::cin;
using std::endl;

int main()
{
	int a, b, temp;
	cout &lt;&lt; &quot;Geben Sie 2 Zahlen ein:&quot; &lt;&lt; endl;
	cin &gt;&gt; a &gt;&gt; b;
	if (a &lt; b) {
		temp = a;
		a = b;
		b = temp;
	}
	cout &lt;&lt; a &lt;&lt; &quot; : &quot; &lt;&lt; b &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>Was in deinem Programm fehlt ist die Möglichkeit eine Variable in einer anderen &quot;abzulegen&quot; um somit die Werte von zwei Variablen miteinander tauschen zu können. Mit diesem Denkanstoß, meinem Codeschnippsel und MFK's Beitrag solltest du nun eigentlich auch 3 Zahlen problemlos absteigend sortieren können <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/1601852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601852</guid><dc:creator><![CDATA[Mizar]]></dc:creator><pubDate>Mon, 20 Oct 2008 17:23:29 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Mon, 20 Oct 2008 19:35:36 GMT]]></title><description><![CDATA[<p>bei mehr als 2 zahlen ist eine schleife aber besser geeignet, könnten ein paar sehr viele bedingungen werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601921</guid><dc:creator><![CDATA[qqqqqqqqqqqqqqqqqqqqqqqqq]]></dc:creator><pubDate>Mon, 20 Oct 2008 19:35:36 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Tue, 21 Oct 2008 05:50:05 GMT]]></title><description><![CDATA[<p>Bumsfidel schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if (a &lt; b) b = a;
</code></pre>
</blockquote>
<p>Das ist keine Vertauschung. Der alte Wert in b ist damit weg. Für eine Vertauschung brauchst du eine dritte Variable, wie in Mizars Beispiel, oder die Funktion std::swap.</p>
<p>Bumsfidel schrieb:</p>
<blockquote>
<pre><code class="language-cpp">else  a = a, b = b;
</code></pre>
</blockquote>
<p>Und das tut gar nichts, kannst du also auch weglassen. Es ist übrigens kein besonders guter Stil, statt einer Blockanweisung den Kommaoperator zu benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601994</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Tue, 21 Oct 2008 05:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsfrage in C++ on Tue, 21 Oct 2008 12:17:48 GMT]]></title><description><![CDATA[<p>if (a&lt;b)b=a<br />
omg was soll das denn werden?<br />
Hier sagst du, dass wenn a kleiner b b a ist O.o<br />
Evt wäre nochmal ein Tutorial für dich geeignet....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602180</guid><dc:creator><![CDATA[Player55]]></dc:creator><pubDate>Tue, 21 Oct 2008 12:17:48 GMT</pubDate></item></channel></rss>