<?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[Vector funktioniert nicht]]></title><description><![CDATA[<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int quot;
long long Testzahl;
int Zehler=0;
int TS;
vector&lt;int&gt;Teiler(1);

int main ()
{
cout&lt;&lt; &quot;Geben Sie die zu testende Zahl ein: &quot;;
cin&gt;&gt;Testzahl;
cout&lt;&lt;&quot;Macro Zahltester benennt Zahl:\n&quot;;

getchar();
for(int i=1;i&lt;=Testzahl;i=i+1)
	{
	quot=Testzahl/i;
		if(0==Testzahl%i)
		{
		Zehler=Zehler+1;
            Teiler.push_back(quot);
		cout&lt;&lt;&quot; &quot;&lt;&lt;quot &lt;&lt;&quot; als  &quot;&lt;&lt;Zehler&lt;&lt;&quot;. Teiler der Zahl  \n&quot;;
		TS=TS+quot;
		}
	}	
//cout&lt;&lt;&quot; als Teiler der Zahl.  \n&quot;;
cout&lt;&lt;&quot; &quot;&lt;&lt;Testzahl&lt;&lt;&quot; hat &quot;&lt;&lt;Zehler&lt;&lt;&quot; Teiler \n&quot;;
    cout&lt;&lt;&quot;Die TS ist: &quot;&lt;&lt;TS&lt;&lt;&quot;&quot;;
    for(auto it=Teiler.begin();it!=Teiler.end();it++){

        cout&lt;&lt;*Teiler&lt;&lt;&quot; + &quot;endl;
        }

    cout&lt;&lt;&quot;=  1 + &quot; &lt;&lt;&quot; + &quot; &lt;&lt;&quot; \n &quot;;
fflush(stdin);
getchar();
</code></pre>
<p>Hallo, das Programm lief, bis ich versuchte einen vector-container für die einzelnen Teiler zu installieren, der am Ende dann die Zeile über einen Iterator ausgeben soll:</p>
<p>Ich möchte am Ende den Satz haben:<br />
Die Teilersumme (Ts) summiert sich aus Teiler 1 + Teiler 2 + Teiler ....<br />
wobei die Teiler aus dem Container vector teiler ausgelesen werden sollen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/320974/vector-funktioniert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 13:14:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/320974.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Oct 2013 12:12:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:15:57 GMT]]></title><description><![CDATA[<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int quot;
long long Testzahl;
int Zehler=0;
int TS;
vector&lt;int&gt;Teiler(1);

int main ()
{
cout&lt;&lt; &quot;Geben Sie die zu testende Zahl ein: &quot;;
cin&gt;&gt;Testzahl;
cout&lt;&lt;&quot;Macro Zahltester benennt Zahl:\n&quot;;

getchar();
for(int i=1;i&lt;=Testzahl;i=i+1)
	{
	quot=Testzahl/i;
		if(0==Testzahl%i)
		{
		Zehler=Zehler+1;
            Teiler.push_back(quot);
		cout&lt;&lt;&quot; &quot;&lt;&lt;quot &lt;&lt;&quot; als  &quot;&lt;&lt;Zehler&lt;&lt;&quot;. Teiler der Zahl  \n&quot;;
		TS=TS+quot;
		}
	}	
//cout&lt;&lt;&quot; als Teiler der Zahl.  \n&quot;;
cout&lt;&lt;&quot; &quot;&lt;&lt;Testzahl&lt;&lt;&quot; hat &quot;&lt;&lt;Zehler&lt;&lt;&quot; Teiler \n&quot;;
    cout&lt;&lt;&quot;Die TS ist: &quot;&lt;&lt;TS&lt;&lt;&quot;&quot;;
    for(auto it=Teiler.begin();it!=Teiler.end();it++){

        cout&lt;&lt;*Teiler&lt;&lt;&quot; + &quot;endl;
        }

    cout&lt;&lt;&quot;=  1 + &quot; &lt;&lt;&quot; + &quot; &lt;&lt;&quot; \n &quot;;
fflush(stdin);
getchar();
</code></pre>
<p>Hallo, das Programm lief, bis ich versuchte einen vector-container für die einzelnen Teiler zu installieren, der am Ende dann die Zeile über einen Iterator ausgeben soll:</p>
<p>Ich möchte am Ende den Satz haben:<br />
Die Teilersumme (Ts) summiert sich aus Teiler 1 + Teiler 2 + Teiler ....<br />
wobei die Teiler aus dem Container vector teiler ausgelesen werden sollen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361353</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:18:40 GMT]]></title><description><![CDATA[<p>das macht ja alles überhaupt keinen Sinn und besonders toll ist deine Fehlerbeschreibung auch nicht - denn sie fehlt vollständig. Wie sollten wir dir helfen?</p>
<p>So wie das Programm aussieht hab ich das Gefühl, dass es niemals funktioniert hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361354</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:18:40 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:40:07 GMT]]></title><description><![CDATA[<p>Er sagt in Zeile 35. Type &quot;vector&lt;int&gt;&quot; does not provide a call operator</p>
<p>Das verstehe ich nicht.</p>
<p>Diese Zeile hab ich im Netz gefunden, adaptiert, weil ich denke, sie macht was ich will (Container + Druck-Iterator)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361356</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361356</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:40:07 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:39:05 GMT]]></title><description><![CDATA[<p>Was genau ist daran unklar? Dort steht <code>Teiler()</code> . Teiler ist ein std::vector, was genau sollte <code>Teiler()</code> deiner Meinung nach tun!?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361357</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361357</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:39:05 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:39:54 GMT]]></title><description><![CDATA[<p>Was soll</p>
<pre><code>Teiler()
</code></pre>
<p>ergeben? Meinst du vielleicht</p>
<pre><code>Teiler.begin()
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2361359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361359</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:39:54 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:48:38 GMT]]></title><description><![CDATA[<p>Im Vector &quot;Teiler&quot; sollen die einzelnen Teiler als Elemente enthalten sein und ausgelesen werden ...</p>
<p>ich versteh ehrlich auch nicht, was der Integer it da soll?</p>
<p>in Zeile 10 wird der Container initialisiert ..<br />
in Zeile 27 wird er gefüttert mit der Variablemn quot : &quot;Teiler.push_back(quot);&quot;<br />
in Zeile 35 soll er über eine Schleife ausgelesen werden, was<br />
in Zeile 37 dann gedruckt wird</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361361</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:48:38 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 12:47:59 GMT]]></title><description><![CDATA[<p>Vertehen wir auch nicht, was ein int dort soll. Du willst wohl eigentlich eher einen iterator...</p>
<p>Mein Rat: Leg dir ein gutes C++ Buch zu und arbeite es durch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361363</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Sat, 19 Oct 2013 12:47:59 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:14:45 GMT]]></title><description><![CDATA[<p>Hab von Dirk louis C++ vor mir liegen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361370</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:14:45 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:18:12 GMT]]></title><description><![CDATA[<p>Na dann...ich kenn das Buch nicht, aber dort steht das sicher nicht so drin, oder? Falls doch: Buch besser wegwerfen und ordentliches Buch kaufen... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361371</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:18:12 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:40:39 GMT]]></title><description><![CDATA[<p>Läuft jetzt:</p>
<p>Frage, Wie bekomme ich die 0 am Anfang der Teilersumme und das letzte + weg?</p>
<blockquote>
<p>Geben Sie die zu testende Zahl ein: 360<br />
Macro Zahltester benennt Zahl:<br />
360 ist der 1. Teiler der Zahl<br />
180 ist der 2. Teiler der Zahl<br />
120 ist der 3. Teiler der Zahl<br />
90 ist der 4. Teiler der Zahl<br />
72 ist der 5. Teiler der Zahl<br />
60 ist der 6. Teiler der Zahl<br />
45 ist der 7. Teiler der Zahl<br />
40 ist der 8. Teiler der Zahl<br />
36 ist der 9. Teiler der Zahl<br />
30 ist der 10. Teiler der Zahl<br />
24 ist der 11. Teiler der Zahl<br />
20 ist der 12. Teiler der Zahl<br />
18 ist der 13. Teiler der Zahl<br />
15 ist der 14. Teiler der Zahl<br />
12 ist der 15. Teiler der Zahl<br />
10 ist der 16. Teiler der Zahl<br />
9 ist der 17. Teiler der Zahl<br />
8 ist der 18. Teiler der Zahl<br />
6 ist der 19. Teiler der Zahl<br />
5 ist der 20. Teiler der Zahl<br />
4 ist der 21. Teiler der Zahl<br />
3 ist der 22. Teiler der Zahl<br />
2 ist der 23. Teiler der Zahl<br />
1 ist der 24. Teiler der Zahl<br />
360 hat 24 Teiler<br />
<strong>0+<strong>360+180+120+90+72+60+45+40+36+30+24+20+18+15+12+10+9+8+6+5+4+3+2+1</strong>+</strong> = 1170 ist die Teilersumme <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
</blockquote>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int quot;
long long Testzahl;
int Zehler=0;
int TS=0;
vector&lt;int&gt;Teiler(1);

int main ()
{
cout&lt;&lt; &quot;Geben Sie die zu testende Zahl ein: &quot;;
cin&gt;&gt;Testzahl;
cout&lt;&lt;&quot;Macro Zahltester benennt Zahl:\n&quot;;

getchar();
for(int i=1;i&lt;=Testzahl;i=i+1)
	{
	quot=Testzahl/i;
		if(0==Testzahl%i)
		{
		Zehler=Zehler+1;
            Teiler.push_back(quot);
		cout&lt;&lt;&quot; &quot;&lt;&lt;quot &lt;&lt;&quot; ist der &quot;&lt;&lt;Zehler&lt;&lt;&quot;. Teiler der Zahl  \n&quot;;
		TS=TS+quot;
		}
	}
    cout&lt;&lt;&quot; &quot;&lt;&lt;Testzahl&lt;&lt;&quot; hat &quot;&lt;&lt;Zehler&lt;&lt;&quot; Teiler \n&quot;;
    //cout&lt;&lt;&quot;Die TS ist: &quot;&lt;&lt;TS&lt;&lt;&quot; = &quot;;
    for(auto it=Teiler.begin();it!=Teiler.end();it++)
    {
        cout&lt;&lt;*it&lt;&lt;&quot;+&quot;;
    }
    cout&lt;&lt;&quot; = &quot;&lt;&lt;TS&lt;&lt;&quot; ist die Teilersumme&quot;;
    fflush(stdin);
    getchar();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2361375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361375</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:40:39 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:35:54 GMT]]></title><description><![CDATA[<p>Fraeg 1 ist gelost, bei der Initialisierung des Vectors muß eine Null als Argument hin!</p>
<p>Jetzt noch das letzte Plus.... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361377</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:35:54 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:48:18 GMT]]></title><description><![CDATA[<pre><code>cout&lt;&lt;*it;
if( it!=Teiler.end()-1 )
    cout&lt;&lt;&quot;+&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2361380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361380</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:52:02 GMT]]></title><description><![CDATA[<p>Ein Problem ist noch:</p>
<p>Der Computer sagt immer, wenn ich das Programm nochmal aufrufe:</p>
<p>“GroßzahlTester” is already running. Click Stop to terminate and launch a new instance.</p>
<p>und das, obwohl ich ein return (0) eingefügt habe.</p>
<p>Wie kann ich das Programm beenden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361381</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:52:02 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:53:05 GMT]]></title><description><![CDATA[<p>Computer neustarten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361382</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:53:05 GMT</pubDate></item><item><title><![CDATA[Reply to Vector funktioniert nicht on Sat, 19 Oct 2013 13:58:04 GMT]]></title><description><![CDATA[<p>Wieso sagt er nicht. &quot;Programm ist beendet&quot; .....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2361386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2361386</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sat, 19 Oct 2013 13:58:04 GMT</pubDate></item></channel></rss>