<?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 mit Bubblesort!!!]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich studiere seit Anfang seit einem halbem Jahr Telekommmunikationsinformatik und wir sollen in C+++ ein programm schreibne welches Zufallszahlen erstellt und die dann mit dem Bubblesort wieder ordnet. Das erstellen von den Zufallszahlen klappt einwandfrei aber ich bekomem den bubblesort einfach nicht hin. Ich weiß auch nicht so rechtwo der hin muss und wie und was. Ich weiß nur das er zahlen vergleicht und die kleinste davon immer nach vorne schiebt... kann mirwer helfen? Hier mein Quelltext zum erzeugen der Zufallszahlen:</p>
<p>--------------------------------------------------------------------</p>
<p>#include &lt;stdlib.h&gt; // rand() Zufallszahlengenerator<br />
#include &lt;time.h&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;conio.h&gt; // srand() Initialisierung<br />
using namespace std;</p>
<p>int main()<br />
{<br />
int x[100], temp, a, b, i;<br />
time_t timer;<br />
srand((unsigned)time(&amp;timer));</p>
<p>cout&lt;&lt;&quot;100 Zahlen unsortiert:\n&quot;&lt;&lt;endl;<br />
for (i=0; i&lt;100; i++)<br />
{<br />
x[i] = rand()% 100;<br />
cout&lt;&lt;x[i];<br />
cout.width(4);</p>
<p>}<br />
cout&lt;&lt;&quot;\n\n100 Zahlen sortiert:\n&quot;&lt;&lt;endl;<br />
getch();</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/166116/hilfe-mit-bubblesort</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 05:27:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/166116.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Nov 2006 13:55:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 13:55:05 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich studiere seit Anfang seit einem halbem Jahr Telekommmunikationsinformatik und wir sollen in C+++ ein programm schreibne welches Zufallszahlen erstellt und die dann mit dem Bubblesort wieder ordnet. Das erstellen von den Zufallszahlen klappt einwandfrei aber ich bekomem den bubblesort einfach nicht hin. Ich weiß auch nicht so rechtwo der hin muss und wie und was. Ich weiß nur das er zahlen vergleicht und die kleinste davon immer nach vorne schiebt... kann mirwer helfen? Hier mein Quelltext zum erzeugen der Zufallszahlen:</p>
<p>--------------------------------------------------------------------</p>
<p>#include &lt;stdlib.h&gt; // rand() Zufallszahlengenerator<br />
#include &lt;time.h&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;conio.h&gt; // srand() Initialisierung<br />
using namespace std;</p>
<p>int main()<br />
{<br />
int x[100], temp, a, b, i;<br />
time_t timer;<br />
srand((unsigned)time(&amp;timer));</p>
<p>cout&lt;&lt;&quot;100 Zahlen unsortiert:\n&quot;&lt;&lt;endl;<br />
for (i=0; i&lt;100; i++)<br />
{<br />
x[i] = rand()% 100;<br />
cout&lt;&lt;x[i];<br />
cout.width(4);</p>
<p>}<br />
cout&lt;&lt;&quot;\n\n100 Zahlen sortiert:\n&quot;&lt;&lt;endl;<br />
getch();</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181676</guid><dc:creator><![CDATA[taikahn]]></dc:creator><pubDate>Sun, 26 Nov 2006 13:55:05 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 13:59:22 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Bubblesort ist einfach zu finden, zum Beispiel in der <a href="http://de.wikipedia.org/wiki/Bubblesort" rel="nofollow">Wikipedia</a>.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181677</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 26 Nov 2006 13:59:22 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 14:06:12 GMT]]></title><description><![CDATA[<p>Hallo!!!</p>
<p>ja ich weiß das man ihn leicht findet aber ich weiß halt nicht wie ich ihn in meine quelltext einbinde... Das funktioniert bei mir nie...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181680</guid><dc:creator><![CDATA[taikahn]]></dc:creator><pubDate>Sun, 26 Nov 2006 14:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 14:12:38 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Um bei dem Beispiel aus Wiki zu bleiben</p>
<pre><code class="language-cpp">#include &lt;stdlib.h&gt; // rand() Zufallszahlengenerator
#include &lt;time.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt; // srand() Initialisierung
using namespace std; 

void bubblesort(int *ptr, int n)
{
   for (int i = 1; i &lt;= n-1; ++i)
      for (int j = 0; j &lt; n-i; ++j)
         if (ptr[j] &gt; ptr[j+1])
         {
             int temp = ptr[j];
             ptr[j]   = ptr[j+1];
             ptr[j+1] = temp;
         }
}

int main()
{
int x[100], temp, a, b, i;
time_t timer;
srand((unsigned)time(&amp;timer));

// Hier sortieren
bubblesort(&amp;x[1], 100); // Adresse des Anfangs vom Array und die Anzahl der Elemente übergeben

cout&lt;&lt;&quot;100 Zahlen unsortiert:\n&quot;&lt;&lt;endl;
for (i=0; i&lt;100; i++)
{
x[i] = rand()% 100;
cout&lt;&lt;x[i];
cout.width(4);

}
cout&lt;&lt;&quot;\n\n100 Zahlen sortiert:\n&quot;&lt;&lt;endl;
getch();
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181683</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 26 Nov 2006 14:12:38 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 14:19:16 GMT]]></title><description><![CDATA[<p>Mh so richtig geht das aber auch ncith wenn ich das compiliere.. Nur fehler meldungen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181685</guid><dc:creator><![CDATA[taikahn]]></dc:creator><pubDate>Sun, 26 Nov 2006 14:19:16 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 14:30:37 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Compilerfehler sollten da nicht kommen, nur ist es noch ein bißchen sinnfrei.<br />
So muß es Compilieren und auch korrekte Werte anzeigen</p>
<pre><code class="language-cpp">#include &lt;stdlib.h&gt; // rand() Zufallszahlengenerator
#include &lt;time.h&gt;
#include &lt;iostream&gt;
#include &lt;conio.h&gt; // srand() Initialisierung
using namespace std;

void bubblesort(int *ptr, int n)
{
   for (int i = 1; i &lt;= n-1; ++i)
      for (int j = 0; j &lt; n-i; ++j)
         if (ptr[j] &gt; ptr[j+1])
         {
             int temp = ptr[j];
             ptr[j]   = ptr[j+1];
             ptr[j+1] = temp;
         }
}

int main()
{
int x[100], temp, a, b, i;
time_t timer;
srand((unsigned)time(&amp;timer));

cout&lt;&lt;&quot;100 Zahlen unsortiert:\n&quot;&lt;&lt;endl;
for (i=0; i&lt;100; i++)
{
x[i] = rand()% 100;
cout&lt;&lt;x[i];
cout.width(4);

}

// Hier sortieren
bubblesort(&amp;x[0], 100); // Adresse des Anfangs vom Array und die Anzahl der Elemente übergeben

cout&lt;&lt;&quot;\n\n100 Zahlen sortiert:\n&quot;&lt;&lt;endl;
for (i=0; i&lt;100; i++)
{
cout&lt;&lt;x[i];
cout.width(4);

}

getch();
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181688</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181688</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 26 Nov 2006 14:30:37 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Sun, 26 Nov 2006 18:05:08 GMT]]></title><description><![CDATA[<p>conio ist ein non-standard-header, srand befindet sich ebenfalls in stdlib.h bzw. cstdlib.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1181820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1181820</guid><dc:creator><![CDATA[Jester]]></dc:creator><pubDate>Sun, 26 Nov 2006 18:05:08 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit Bubblesort!!! on Mon, 27 Nov 2006 07:48:46 GMT]]></title><description><![CDATA[<p>zeig mal dein bisherien code -&gt; taikahn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1182030</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1182030</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Mon, 27 Nov 2006 07:48:46 GMT</pubDate></item></channel></rss>