<?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[array erzeugen]]></title><description><![CDATA[<p>Hallo,</p>
<p>für ein Programm brauche ich ein zweidimensionales Array.<br />
Allerdings will ich die Anzahl der Reihen und Spalten während des Programmablaufs ändern können. Aber ich habe keine Ahnung wie ich das hinkriegen kann.</p>
<p>Für Vorschläge wäre ich dankbar!</p>
<p>Gruß,<br />
sceche</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/257152/array-erzeugen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 05:43:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/257152.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Dec 2009 19:40:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 19:40:33 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>für ein Programm brauche ich ein zweidimensionales Array.<br />
Allerdings will ich die Anzahl der Reihen und Spalten während des Programmablaufs ändern können. Aber ich habe keine Ahnung wie ich das hinkriegen kann.</p>
<p>Für Vorschläge wäre ich dankbar!</p>
<p>Gruß,<br />
sceche</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1826986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1826986</guid><dc:creator><![CDATA[sceche]]></dc:creator><pubDate>Wed, 23 Dec 2009 19:40:33 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 19:59:19 GMT]]></title><description><![CDATA[<p>Ein dynamisches array kannst du mit new erzeugen. Alternativ solltest du dir mal STL-Container wie std::Vector ansehen. die wachsen dynamisch und raeumen am Schluss Auch selbst auf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1826991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1826991</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Wed, 23 Dec 2009 19:59:19 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:18:38 GMT]]></title><description><![CDATA[<p>Könntet ihr mir vielleicht ein Beispiel angeben.<br />
Und wie lösche bzw. füge ich eine neue Reihe oder Spalte hinzu?<br />
Kenne mich da nämlich nicht so gut aus</p>
<p>Danke im Voraus</p>
<p>sceche</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827003</guid><dc:creator><![CDATA[sceche]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:18:38 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:20:16 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-14774.html" rel="nofollow">akari</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html" rel="nofollow">VCL (C++ Builder)</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827004</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:30:11 GMT]]></title><description><![CDATA[<p>Man könnte es auch so machen. Dann nutzt man kein stl, doch es ist ein bisschen aufwändiger. Das ist jetzt nur eindimensional, aber Du kannst es ja ändern.</p>
<pre><code class="language-cpp">template &lt;typename T&gt; class DynArray
{
 public:
  DynArray() { //Default-Konstruktor
   str.len=1;
   str.array=new T[1];
   str.array[0]=0;
  }
  DynArray(int size) { //Überladener Konstruktor
   str.len=size;
   str.array=new T[size];
   for (int i=0; i&lt;size; i++)
    str.array[i]=0;
  }
  ~DynArray() {
   delete [] str.array;
  }
  int Length (void) {
   return str.len;
  }
  void NewSize (int NewSize) {
    T *temp=new T[str.len];
    for (int i=0; i&lt;str.len; i++)
     temp[i]=str.array[i];
    delete [] str.array;
    str.array = new T[NewSize];
    for (int i=0; i&lt;NewSize; i++) {
     if(i&lt;=str.len) str.array[i]=temp[i];
     else str.array[i]=0;
    }
    str.len=NewSize;
    delete [] temp;
   }
  void Insert (int key, T value) {
   if (key &gt;= str.len || str.len==0) NewSize(key+1);
   str.array[key]=value;
  }
  T Read (int index) {
   if (index&gt;str.len) NewSize(index+1);
  return str.array[index];
  }
  void Delete (int index) {
   if (index&gt;str.len) NewSize(index+1);
   delete str.array[index];
   str.len--;
  }
  T operator [] (int index) {
   if(index &gt;= str.len) NewSize(index+1);
   return str.array[index];
  }
 private:
  struct Ar {
   T *array;
   int len;
   } str;
};
</code></pre>
<p>lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827010</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:30:11 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:46:51 GMT]]></title><description><![CDATA[<p>Das sieht aber recht kompliziert aus...</p>
<p>Was ist denn genau STL und wie gehe ich damit um?<br />
(Frage ist bestimmt total dumm, aber ich bin halt Anfänger <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/1827015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827015</guid><dc:creator><![CDATA[sceche]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:46:51 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Mon, 16 Aug 2010 19:36:52 GMT]]></title><description><![CDATA[<p>Huhu,</p>
<pre><code class="language-cpp">#include &lt;vector&gt; // STL-Vector

int main()
{
    std::vector&lt;int&gt; field ; // Deklaration
}
</code></pre>
<p><a href="http://www.cplusplus.com/reference/stl/vector/" rel="nofollow">Für nähere Informationen siehe: vector - C++ Reference</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827017</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 16 Aug 2010 19:36:52 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:51:07 GMT]]></title><description><![CDATA[<p>Oder lies dich in die STL-Artikel aus dem Magazin ein:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-143816.html" rel="nofollow"><strong>1)</strong> Container</a><br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-146604.html" rel="nofollow"><strong>2)</strong> Iteratoren und Algorithmen</a><br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-150106.html" rel="nofollow"><strong>3)</strong> Hilfsklassen und Erweiterungen</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827020</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:51:07 GMT</pubDate></item><item><title><![CDATA[Reply to array erzeugen on Wed, 23 Dec 2009 20:55:11 GMT]]></title><description><![CDATA[<p>sceche schrieb:</p>
<blockquote>
<p>Das sieht aber recht kompliziert aus...</p>
<p>Was ist denn genau STL und wie gehe ich damit um?<br />
(Frage ist bestimmt total dumm, aber ich bin halt Anfänger <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>
</blockquote>
<p>Vergiß die STL. Es geht zwar mit einem Vector, in den Du Pointer auf Vektoren<br />
legst, aber das ist böse, weil kaum leserlich. Und wie siehts dann erst aus,<br />
wenn Du einmal drei oder vier Dimensionen brauchst? Machs mit Boost:</p>
<p><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_array/doc/user.html" rel="nofollow">http://www.boost.org/doc/libs/1_41_0/libs/multi_array/doc/user.html</a></p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827022</guid><dc:creator><![CDATA[bts2]]></dc:creator><pubDate>Wed, 23 Dec 2009 20:55:11 GMT</pubDate></item></channel></rss>