<?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[Vektor ausgeben]]></title><description><![CDATA[<p>ich hab noch eine frage zu vektoren, und zwar wollte ich das letzte Element eines Vekors ausgeben.</p>
<pre><code class="language-cpp">h = zahl[zahl.size()];
</code></pre>
<p>leider kommt da immer eine Fehlermeldung.</p>
<p>Kann mir jemand sagen, was ich falsch gemacht habe??</p>
<p>gruß Gucky</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275544/vektor-ausgeben</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 17:59:41 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275544.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Oct 2010 15:31:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 15:31:29 GMT]]></title><description><![CDATA[<p>ich hab noch eine frage zu vektoren, und zwar wollte ich das letzte Element eines Vekors ausgeben.</p>
<pre><code class="language-cpp">h = zahl[zahl.size()];
</code></pre>
<p>leider kommt da immer eine Fehlermeldung.</p>
<p>Kann mir jemand sagen, was ich falsch gemacht habe??</p>
<p>gruß Gucky</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966444</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966444</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sat, 16 Oct 2010 15:31:29 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 15:34:51 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">h = zahl[zahl.size()-1];
</code></pre>
<p>Fang immer bei 0 an zu zählen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966446</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966446</guid><dc:creator><![CDATA[Besserwisser]]></dc:creator><pubDate>Sat, 16 Oct 2010 15:34:51 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 15:42:38 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">h = zahl.back();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1966449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966449</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 16 Oct 2010 15:42:38 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 16:33:15 GMT]]></title><description><![CDATA[<p>danke <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>aber</p>
<pre><code class="language-cpp">h = zahl.back();
</code></pre>
<p>erfüllt einen anderen zweck</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966468</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966468</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sat, 16 Oct 2010 16:33:15 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 16:35:11 GMT]]></title><description><![CDATA[<p>Nö.<br />
Das macht genau das selbe.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966471</guid><dc:creator><![CDATA[theliquidwave]]></dc:creator><pubDate>Sat, 16 Oct 2010 16:35:11 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 16:50:57 GMT]]></title><description><![CDATA[<p>sry stimmt aber man muss auch noch mit 1 dividiere</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966474</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sat, 16 Oct 2010 16:50:57 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 17:03:53 GMT]]></title><description><![CDATA[<p>am einfachsten ist es aber mit</p>
<pre><code class="language-cpp">h = zahl.capacity();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1966482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966482</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sat, 16 Oct 2010 17:03:53 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sat, 16 Oct 2010 19:57:03 GMT]]></title><description><![CDATA[<p>Gucky schrieb:</p>
<blockquote>
<p>sry stimmt aber man muss auch noch mit 1 dividiere</p>
</blockquote>
<p>Was? Dividieren? 1? Was machst du da <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>
<p>Gucky schrieb:</p>
<blockquote>
<p>am einfachsten ist es aber mit</p>
<pre><code class="language-cpp">h = zahl.capacity();
</code></pre>
</blockquote>
<p>WTF? Das gibt die Größe des reservierten Speichers zurück, macht also rein gar nicht, was du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966544</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966544</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 16 Oct 2010 19:57:03 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 05:40:02 GMT]]></title><description><![CDATA[<p>Gucky schrieb:</p>
<blockquote>
<p>sry stimmt aber man muss auch noch mit 1 dividiere</p>
</blockquote>
<p>Muss man nicht, man kann auch mit 1 multiplizieren. <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>
<p>Das erfüllt genau denselben Zweck (nämlich keinen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966598</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Sun, 17 Oct 2010 05:40:02 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 05:48:02 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> Da fragt man sich doch, ob er nur rumtrollt oder wirklich absolut keine Ahnung hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966599</guid><dc:creator><![CDATA[also ehrlich]]></dc:creator><pubDate>Sun, 17 Oct 2010 05:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 10:34:46 GMT]]></title><description><![CDATA[<p>es funktioniert, weil ich vorher nicht sage, wie viele werte in den vektor kommen, also wenn im vector 1, 2 steht ist die capacity 2. ich weiß nicht was daran falsch wäre??</p>
<p>ps. ich hab mich verschrieben beim dividieren, ich meinte subtrahieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966642</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 10:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:19:33 GMT]]></title><description><![CDATA[<p>Zuerst entscheidest du dich mal, ob du das letzte Element oder die Größe des Vectors haben willst. Dann schaust du dir mal <a href="http://cplusplus.com/reference/stl/vector/capacity/" rel="nofollow">diese Seite</a> an, damit du verstehst, was capacity macht (schau dir vor allem die Ausgabe von dem Beispiel an!).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966653</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:19:33 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:30:04 GMT]]></title><description><![CDATA[<p>also ich möchte die größe des vectors</p>
<p>ok, bin jetzt überzeugt das es nicht mit capacity geht, aber versteh auch nicht warum das in meinem code immer genau gleich groß war wie die größe (size).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966657</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:38:37 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int main ()
{
	std::vector&lt;int&gt; v(500);
	cout &lt;&lt; &quot;size :\t\t&quot;	&lt;&lt; v.size()		&lt;&lt;endl;
	cout &lt;&lt; &quot;capacity :\t&quot;	&lt;&lt; v.capacity() &lt;&lt;endl;
	cout &lt;&lt; &quot;max_size :\t&quot;	&lt;&lt; v.max_size() &lt;&lt;endl;
	v.push_back(1);
	cout &lt;&lt; &quot;size :\t\t&quot;	&lt;&lt; v.size()		&lt;&lt;endl;
	cout &lt;&lt; &quot;capacity :\t&quot;	&lt;&lt; v.capacity() &lt;&lt;endl;
	cout &lt;&lt; &quot;max_size :\t&quot;	&lt;&lt; v.max_size() &lt;&lt;endl;
	return 0;
}
</code></pre>
<p>Edit : Ausgabe für alle, die es nicht testen wollen:<br />
<a href="http://codepad.org/CmAKkrYD" rel="nofollow">http://codepad.org/CmAKkrYD</a><br />
Beim MSVC 2008 pro ist die Kapazität anschließend 750.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966659</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:40:57 GMT]]></title><description><![CDATA[<p>ok</p>
<p>aber was für einen wert stellt capacity genau dar??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966660</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:40:57 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:42:26 GMT]]></title><description><![CDATA[<p>Michael E. schrieb:</p>
<blockquote>
<p>Das gibt die Größe des reservierten Speichers zurück,..</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1966661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966661</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:42:26 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 11:47:49 GMT]]></title><description><![CDATA[<p>in was für einer einheit denn??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966666</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:47:49 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 12:02:20 GMT]]></title><description><![CDATA[<p>Lies den Link!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966671</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:02:20 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 12:45:24 GMT]]></title><description><![CDATA[<p>hab ich, find aber keine einheit!</p>
<p>es wird immer d´nur von der &quot;Größe&quot; gesprochen, hab ich was überlesen??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966683</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:45:24 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 13:04:08 GMT]]></title><description><![CDATA[<p>Gucky schrieb:</p>
<blockquote>
<p>hab ich was überlesen??</p>
</blockquote>
<p>Ja.</p>
<p>(Auch wenn ich mir ziemlich sicher bin, dass du uns bloß verarschen willst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966692</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:04:08 GMT</pubDate></item><item><title><![CDATA[Reply to Vektor ausgeben on Sun, 17 Oct 2010 13:09:57 GMT]]></title><description><![CDATA[<p>ok man muss lesen können...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966693</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966693</guid><dc:creator><![CDATA[Gucky]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:09:57 GMT</pubDate></item></channel></rss>