<?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[List-Frage]]></title><description><![CDATA[<p>Wenn ich die List-Deklaration in Zeile 18 wegkommentiere rechn3t er richtig, wenn ich sie stehen lasse, hat er offensichtlich zwei Kontainer selbigen Namens. Warum?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include&lt;list&gt;
using namespace std;

int t=1;
int n=0;
int quot;

void wennganzzahligerteiler();
void wennbruch();
void wennnichprim();
list&lt;int&gt;teiler;

int main(int argc, const char * argv[])
{
   list&lt;int&gt;teiler;
    for (n = 1; n &lt;=7; n=n+1) //Grundzahlproduzent
    {
        cout&lt;&lt;&quot;\nzu &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
        teiler.clear();
        for (t = 1; t&lt;=n; t=t+1) // Teilerhersteller
            {
            cout&lt;&lt;n&lt;&lt;&quot;=n &quot;&lt;&lt;t&lt;&lt;&quot;=t \n&quot;;
                if (n%t==0) // dann Modulo = 0 dh.(ganzzahliges Ergebnis) nur, wenn ganzzahliger Teiler
                    {
                       wennganzzahligerteiler();
                        teiler.push_back(t);

                    }
                    else //wennbruch
                    {
                        wennbruch();
                    }

                cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, näml.&quot;;
                for(auto it=teiler.begin();it !=teiler.end();it++)
                { cout&lt;&lt;*it&lt;&lt;&quot;; &quot;;}
                cout&lt;&lt;&quot;\n&quot;;

            }

    }
return 0;
}

void wennganzzahligerteiler()
{
    quot=n/t;
cout&lt;&lt;n&lt;&lt;&quot;/&quot;&lt;&lt;t&lt;&lt;&quot;=&quot;&lt;&lt;n/t&lt;&lt;&quot; \n&quot;;
cout&lt;&lt;t&lt;&lt;&quot; ist Teiler von &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;

}

void wennbruch()
{
    cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, nämlich  &quot;;
    for(auto it=teiler.begin();it !=teiler.end();it++)
    { cout&lt;&lt;*it&lt;&lt;&quot; &quot;;}
    //cout&lt;&lt;&quot;\n&quot;;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/327857/list-frage</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 16:45:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/327857.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Sep 2014 16:37:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 16:37:21 GMT]]></title><description><![CDATA[<p>Wenn ich die List-Deklaration in Zeile 18 wegkommentiere rechn3t er richtig, wenn ich sie stehen lasse, hat er offensichtlich zwei Kontainer selbigen Namens. Warum?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include&lt;list&gt;
using namespace std;

int t=1;
int n=0;
int quot;

void wennganzzahligerteiler();
void wennbruch();
void wennnichprim();
list&lt;int&gt;teiler;

int main(int argc, const char * argv[])
{
   list&lt;int&gt;teiler;
    for (n = 1; n &lt;=7; n=n+1) //Grundzahlproduzent
    {
        cout&lt;&lt;&quot;\nzu &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
        teiler.clear();
        for (t = 1; t&lt;=n; t=t+1) // Teilerhersteller
            {
            cout&lt;&lt;n&lt;&lt;&quot;=n &quot;&lt;&lt;t&lt;&lt;&quot;=t \n&quot;;
                if (n%t==0) // dann Modulo = 0 dh.(ganzzahliges Ergebnis) nur, wenn ganzzahliger Teiler
                    {
                       wennganzzahligerteiler();
                        teiler.push_back(t);

                    }
                    else //wennbruch
                    {
                        wennbruch();
                    }

                cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, näml.&quot;;
                for(auto it=teiler.begin();it !=teiler.end();it++)
                { cout&lt;&lt;*it&lt;&lt;&quot;; &quot;;}
                cout&lt;&lt;&quot;\n&quot;;

            }

    }
return 0;
}

void wennganzzahligerteiler()
{
    quot=n/t;
cout&lt;&lt;n&lt;&lt;&quot;/&quot;&lt;&lt;t&lt;&lt;&quot;=&quot;&lt;&lt;n/t&lt;&lt;&quot; \n&quot;;
cout&lt;&lt;t&lt;&lt;&quot; ist Teiler von &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;

}

void wennbruch()
{
    cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, nämlich  &quot;;
    for(auto it=teiler.begin();it !=teiler.end();it++)
    { cout&lt;&lt;*it&lt;&lt;&quot; &quot;;}
    //cout&lt;&lt;&quot;\n&quot;;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2416555</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416555</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 16:37:21 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 16:41:36 GMT]]></title><description><![CDATA[<p>Der Grund liegt an der Verwendung globaler Variablen.<br />
Verwende keine globalen Variablen, erst recht nicht für for-Schleifen!<br />
Definiere Variablen erst so spät wie möglich und nutze Argumente und Rückgabewerte für Funktionen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416556</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 08 Sep 2014 16:41:36 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 17:42:46 GMT]]></title><description><![CDATA[<p>Danke, habe jetzt mal so gemacht:</p>
<p>Mir ist nicht klar, warum ich vor die Funktion noch void (leer) schreibe, obwohl ich doch Parameter übergebe. Es läuft übrigens nicht.</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include&lt;list&gt;
using namespace std;

int quot;

void wennganzzahligerteiler();
void wennbruch();
void wennnichprim();
 list&lt;int&gt;teiler;

int main(int argc, const char * argv[])
{
   list&lt;int&gt;teiler;
    for (int n = 1; n &lt;=7; n=n+1) //Grundzahlproduzent
    {
        cout&lt;&lt;&quot;\nzu &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
        teiler.clear();
        for (int t = 1; t&lt;=n; t=t+1) // Teilerhersteller
            {
            cout&lt;&lt;n&lt;&lt;&quot;=n &quot;&lt;&lt;t&lt;&lt;&quot;=t \n&quot;;
                if (n%t==0) // dann Modulo = 0 dh.(ganzzahliges Ergebnis) nur, wenn ganzzahliger Teiler
                    {
                       wennganzzahligerteiler();
                        teiler.push_back(t);

                    }
                    else //wennbruch
                    {
                        wennbruch();
                    }

                cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, näml.&quot;;
                for(auto it=teiler.begin();it !=teiler.end();it++)
                { cout&lt;&lt;*it&lt;&lt;&quot;; &quot;;}
                cout&lt;&lt;&quot;\n&quot;;

            }

    }
return 0;
}

void wennganzzahligerteiler(int t, int n)
{
    quot=n/t;
cout&lt;&lt;n&lt;&lt;&quot;/&quot;&lt;&lt;t&lt;&lt;&quot;=&quot;&lt;&lt;n/t&lt;&lt;&quot; \n&quot;;
cout&lt;&lt;t&lt;&lt;&quot; ist Teiler von &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;

}

void wennbruch(int n)
{
    cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, nämlich  &quot;;
    for(auto it=teiler.begin();it !=teiler.end();it++)
    { cout&lt;&lt;*it&lt;&lt;&quot; &quot;;}
    //cout&lt;&lt;&quot;\n&quot;;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2416562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416562</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 17:42:46 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 17:47:57 GMT]]></title><description><![CDATA[<p>Du hast ja auch immer noch zwei globale Variablen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416563</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 08 Sep 2014 17:47:57 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 18:01:32 GMT]]></title><description><![CDATA[<p>wieso 2, ich seh nur quot? ... ich will bloß nicht alles mit einemmal kaputtmachen .... brauch es übrigens gar nicht mehr, habe es gelöscht, läuft trotzdem nicht ...</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include&lt;list&gt;
using namespace std;

void wennganzzahligerteiler();
void wennbruch();
void wennnichprim();
list&lt;int&gt;teiler;

int main(int argc, const char * argv[])
{
   list&lt;int&gt;teiler;
    for (int n = 1; n &lt;=7; n=n+1) //Grundzahlproduzent
    {
        cout&lt;&lt;&quot;\nzu &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
        teiler.clear();
        for (int t = 1; t&lt;=n; t=t+1) // Teilerhersteller
            {
            cout&lt;&lt;n&lt;&lt;&quot;=n &quot;&lt;&lt;t&lt;&lt;&quot;=t \n&quot;;
                if (n%t==0) // dann Modulo = 0 dh.(ganzzahliges Ergebnis) nur, wenn ganzzahliger Teiler
                    {
                       wennganzzahligerteiler();
                        teiler.push_back(t);
                    }
                    else //wennbruch
                    {
                        wennbruch();
                    }
                cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, näml.&quot;;
                for(auto it=teiler.begin();it !=teiler.end();it++)
                { cout&lt;&lt;*it&lt;&lt;&quot;; &quot;;}
                cout&lt;&lt;&quot;\n&quot;;
            }
    }
return 0;
}

void wennganzzahligerteiler(int t, int n)
{
cout&lt;&lt;n&lt;&lt;&quot;/&quot;&lt;&lt;t&lt;&lt;&quot;=&quot;&lt;&lt;n/t&lt;&lt;&quot; \n&quot;;
cout&lt;&lt;t&lt;&lt;&quot; ist Teiler von &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
}

void wennbruch(int n)
{
    cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, nämlich  &quot;;
    for(auto it=teiler.begin();it !=teiler.end();it++)
    { cout&lt;&lt;*it&lt;&lt;&quot; &quot;;}
    //cout&lt;&lt;&quot;\n&quot;;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2416566</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416566</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 18:01:32 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 18:22:05 GMT]]></title><description><![CDATA[<p>brak schrieb:</p>
<blockquote>
<p>wieso 2, ich seh nur quot? ... ich will bloß nicht alles mit einemmal kaputtmachen .... brauch es übrigens gar nicht mehr, habe es gelöscht, läuft trotzdem nicht ...</p>
</blockquote>
<p>Du hast immer noch eine, unter der Deklaration von wennnichprim().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416570</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416570</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 08 Sep 2014 18:22:05 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 18:50:37 GMT]]></title><description><![CDATA[<p>Wenn ich also &quot;int Teiler&quot; in die Deklaration als Argument schreibe, dann sagt er: member reference base type int is not a structure or union</p>
<p>Was meint das?</p>
<pre><code>void wennbruch(int n, int teiler)
{
    cout&lt;&lt;n&lt;&lt;&quot; hat &quot;&lt;&lt;teiler.size()&lt;&lt;&quot; Teiler, nämlich  &quot;;
    for(auto it=teiler.begin();it !=teiler.end();it++)
    { cout&lt;&lt;*it&lt;&lt;&quot; &quot;;}
    //cout&lt;&lt;&quot;\n&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2416572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416572</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 18:50:37 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 18:55:11 GMT]]></title><description><![CDATA[<p>brak schrieb:</p>
<blockquote>
<p>Wenn ich also &quot;int Teiler&quot; in die Deklaration als Argument schreibe, dann sagt er: member reference base type int is not a structure or union</p>
<p>Was meint das?</p>
<pre><code>for(auto it=teiler.begin();it !=teiler.end();it++)
</code></pre>
</blockquote>
<p>Das meint, dass ein int keine Methoden namens begin() bzw. end() hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416573</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Mon, 08 Sep 2014 18:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 18:55:53 GMT]]></title><description><![CDATA[<p>Das heisst, dass Du auf ints nicht .begin() aufrufen kannst.</p>
<p>&lt;edit&gt;2 doofe, ein Gedanke...&lt;/edit&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416574</guid><dc:creator><![CDATA[SG1]]></dc:creator><pubDate>Mon, 08 Sep 2014 18:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:03:35 GMT]]></title><description><![CDATA[<p>Au, da weiss ich jetzt nicht weiter, kann mal jemand die Zeile gut schreiben...?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416575</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:03:35 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:06:10 GMT]]></title><description><![CDATA[<p>brak schrieb:</p>
<blockquote>
<p>Au, da weiss ich jetzt nicht weiter, kann mal jemand die Zeile gut schreiben...?</p>
</blockquote>
<p>Du willst keinen teiler haben, der ein int ist; du willst eine Liste von Teilern. Also gib auch eine Liste von Teilern!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416576</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:06:10 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:19:58 GMT]]></title><description><![CDATA[<pre><code>void wennbruch(int n, list.teiler)
</code></pre>
<p>das scheint falsch zu sein....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416578</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:19:58 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:36:03 GMT]]></title><description><![CDATA[<p>Sag mal ehrlich, der Code ist doch von irgendwo herkopiert und bisschen modifiziert oder?</p>
<blockquote>
<p>Mir ist nicht klar, warum ich vor die Funktion noch void (leer) schreibe, obwohl ich doch Parameter übergebe.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2416582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416582</guid><dc:creator><![CDATA[hmm__1]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:36:03 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:41:54 GMT]]></title><description><![CDATA[<p>Angemeldet 2008. Das ist doch ein Witz, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416583</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:41:54 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 19:55:13 GMT]]></title><description><![CDATA[<p>Hab gerade Zeit, mich mit dem von vor 2 Jahren erworbenen Buch zu beschäftigen; Dirk louis C++, bin ja bloß gelegentlicher Hobbyprogrammierer... und bin am lernen Funktion ..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416585</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Mon, 08 Sep 2014 19:55:13 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 20:01:36 GMT]]></title><description><![CDATA[<p>Ich würde empfehlen das Buch nochmals von ANFANG an durchzuarbeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416586</guid><dc:creator><![CDATA[hmm__1]]></dc:creator><pubDate>Mon, 08 Sep 2014 20:01:36 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Mon, 08 Sep 2014 20:05:07 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Angemeldet 2008. Das ist doch ein Witz, oder?</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416587</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416587</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Mon, 08 Sep 2014 20:05:07 GMT</pubDate></item><item><title><![CDATA[Reply to List-Frage on Tue, 09 Sep 2014 08:38:45 GMT]]></title><description><![CDATA[<p>brak schrieb:</p>
<blockquote>
<p>Hab gerade Zeit, mich mit dem von vor 2 Jahren erworbenen Buch zu beschäftigen; Dirk louis C++, bin ja bloß gelegentlicher Hobbyprogrammierer... und bin am lernen Funktion ..</p>
</blockquote>
<p>Ich bin mir 100%ig sicher das auch Dirk Louis bei Funktionen eindeutig beschreibt was ein Rückgabeparameter ist, was void an dieser Stelle bedeutet, und das Übergabeparameter wieder etwas ganz anderes sind. Das Problem ist schlicht das du nicht liest, und wir sind auch nicht unbedingt bereit jeden Kleinstfehler häppchenweise zu korrigieren. Das bringt beiden Seiten nichts.</p>
<p>Daher lies das Buch von vorne durch, versuch das geschriebene auch wirklich zu verstehen, und stelle DANN konkrete Fragen wenn du etwas nicht verstehst. Ich habe den Verdacht das du das Buch nur überfliegst, oder Unklarheiten so lange aufschiebst das diese sich zu einem großen Fehlerberg aufsummieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2416641</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2416641</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Tue, 09 Sep 2014 08:38:45 GMT</pubDate></item></channel></rss>