<?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]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe da mal eine Frage!<br />
Wie kann ich mehrere Daten in einen Array speichern?</p>
<p>Zum Beispiel soll ich bei einer Person: Name, Vorname, Geburtsdatum, usw. speichern.</p>
<p>Durch suchen einer Person, sollen dann die ganzen Daten über diese Person ausgegeben werden.</p>
<p>Kann man das anhand eines eindimensionalen Arrays auch machen?</p>
<p>Das alles soll OOP sein!</p>
<p>Maximal 100 Personen!</p>
<p>z.B.</p>
<pre><code>{
class person

private:
string name;
string vorname;
int geburtsdatum;

public:
person (string name, string vorname, int geburtsadatum);
~person();
};

person::person [100] (string n, string v, int g)
{
n=name;
v=vorname;
g=geburtsdatum;
}
</code></pre>
<p>usw.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/151114/array</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 08:37:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/151114.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 23 Jun 2006 08:48:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 08:48:32 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe da mal eine Frage!<br />
Wie kann ich mehrere Daten in einen Array speichern?</p>
<p>Zum Beispiel soll ich bei einer Person: Name, Vorname, Geburtsdatum, usw. speichern.</p>
<p>Durch suchen einer Person, sollen dann die ganzen Daten über diese Person ausgegeben werden.</p>
<p>Kann man das anhand eines eindimensionalen Arrays auch machen?</p>
<p>Das alles soll OOP sein!</p>
<p>Maximal 100 Personen!</p>
<p>z.B.</p>
<pre><code>{
class person

private:
string name;
string vorname;
int geburtsdatum;

public:
person (string name, string vorname, int geburtsadatum);
~person();
};

person::person [100] (string n, string v, int g)
{
n=name;
v=vorname;
g=geburtsdatum;
}
</code></pre>
<p>usw.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083609</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Fri, 23 Jun 2006 08:48:32 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 08:51:10 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Du erstellst die Klasse Person und packst dann 100 davon in eine arry.</p>
<pre><code class="language-cpp">Peron Personen[100];
</code></pre>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083610</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 23 Jun 2006 08:51:10 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 08:51:34 GMT]]></title><description><![CDATA[<p>Schreibe eine Klasse Person, die alle Daten einer Person enthält. Dann kannst du Objekte dieser Klasse (oder Refrenzen auf diese Objekte) in einem Array speichern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083611</guid><dc:creator><![CDATA[DarthZiu]]></dc:creator><pubDate>Fri, 23 Jun 2006 08:51:34 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 13:29:03 GMT]]></title><description><![CDATA[<p>Dumme Frage!<br />
Wie soll das ungefähr ausschauen?</p>
<p>Komm jetzt nicht drauf!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083808</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083808</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Fri, 23 Jun 2006 13:29:03 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 13:35:10 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Nydro schrieb:</p>
<blockquote>
<p>Dumme Frage!<br />
Wie soll das ungefähr ausschauen?</p>
<p>Komm jetzt nicht drauf!</p>
</blockquote>
<p>Was meinst du? Du schreibst eine Klasse mit den Namen Person und gibst diese alle Variabeln und Methoden die du brauchst (Name, Geburtstag, Anschrift, Telefon,...) und dann legst du ein array mit mehreren Personen an.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083811</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083811</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 23 Jun 2006 13:35:10 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 13:37:59 GMT]]></title><description><![CDATA[<p>Nydro schrieb:</p>
<blockquote>
<p>Dumme Frage!<br />
Wie soll das ungefähr ausschauen?</p>
<p>Komm jetzt nicht drauf!</p>
</blockquote>
<p>du hast deine klasse person:</p>
<pre><code class="language-cpp">class person 
{
private: 
string name; 
string vorname; 
int geburtsdatum; 

public: 
person (string name, string vorname, int geburtsadatum); 
~person(); 
}; 

person::person(string n, string v, int g) 
{ 
n=name; 
v=vorname; 
g=geburtsdatum; 
}
</code></pre>
<p>und dann machst du ein array davon:</p>
<pre><code class="language-cpp">person array[100];
</code></pre>
<p>oder eben ueber std::vector&lt;person&gt; oder aehnliches...</p>
<p>eine klasse ist eine einheit. eine person ist ein abgeschlossenes etwas. ob es jetzt 100 oder eine million personen gibt ist der person egal. im prinzip kennt eine person doch sowieso keine anderen personen. eine person ist also auch super gluecklich wenn sie ganz alleine sit.</p>
<p>das konzept dass man nun mehrere personen haben kann ist etwas dass die person nichts angeht. hierfuehr brauchen wir &quot;controller&quot; die feststellen &quot;aha, es gibt mehrere personen, um genauzusein gibt es 100. ich will alle personen kennen&quot;.</p>
<p>dann haben wir mit diesem &quot;controller&quot; eine komplett neue einheit, die im prinzip groesstenteils unabhaengig von den einzelnen personen funktioniert - es findet zumindest keine kommunikation zwischen dem controller und den personen statt:</p>
<p>person controller[100];</p>
<p>klingt jetzt etwas hochtrabend ein array &quot;controller&quot; zu nennen, aber du solltest diesen gedankengang verstehen lernen, diese trennung der einzelnen einheiten und wie sie mit einander interagieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083816</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083816</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Fri, 23 Jun 2006 13:37:59 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 14:43:15 GMT]]></title><description><![CDATA[<p>Meint ihr so?</p>
<pre><code>class person
{
private:
string name;
string vorname;
int geburtsdatum;

public:
person (string name, string vorname, int geburtsadatum);
~person();
};

person::person(string n, string v, int g)
{
n=name;
v=vorname;
g=geburtsdatum;
}

int main ()
{
person personen [100]
</code></pre>
<p>Ich bekomme da aber immer eine Fehlermeldung!<br />
Cannot find default constructor ti initialize array element of type person !!!!</p>
<p>Gibts da irgendwo ein Programm als Beispiel?<br />
Irgendwie blicke ich nicht mehr durch! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083862</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083862</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Fri, 23 Jun 2006 14:43:15 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 15:08:53 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Wenn du ein array erstellen willst, brauchst du auch einen Standardc'tor. Also schreibe noch einen, der Parameter erwartet. Das nennt man dann überladen.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1083882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1083882</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 23 Jun 2006 15:08:53 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 17:24:16 GMT]]></title><description><![CDATA[<p>Okay Danke!</p>
<p>Bin jetzt schon weiter gekommen!</p>
<p>Aber wie mache ich das jetzt mit dem Zeiger? Damit ich die Daten ins Array schreiben kann?</p>
<p>Wo schreibe ich das jetzt hin?</p>
<pre><code>int wert[MAX];

  for(i=0; i&lt;MAX; i++)
  {
      wert[i] = 0;
  }
</code></pre>
<p>Bekomme jetzt die Fehlermeldung &quot;Structure required on left side of. or. *&quot;</p>
<p>Danke schonmal im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084042</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Fri, 23 Jun 2006 17:24:16 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 18:13:25 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Kannst du mal dazu sagen, wo du die Fehlermeldung bekommst und außerdem ist in deinem Abschnitt i nicht definiert (deklariert - ich verwechsele es immer)</p>
<pre><code class="language-cpp">for(unsigned int i=0; i&lt; MAX; ++i)
</code></pre>
<p>wäre besser.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084089</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 23 Jun 2006 18:13:25 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Fri, 23 Jun 2006 21:46:05 GMT]]></title><description><![CDATA[<p>Nydro schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int wert[ MAX ];

for( unsigned int i = 0; i &lt; MAX; i++ ) {

    wert[ i ] = 0;
}
</code></pre>
<p>Bekomme jetzt die Fehlermeldung: &quot;Structure required on left side of . or *&quot;</p>
</blockquote>
<p>Entweder hab' ich ein Problem mit meinen Augen, oder in deinem Code ist wirklich weder ein '.' oder '*'...</p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084256</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Fri, 23 Jun 2006 21:46:05 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sat, 24 Jun 2006 12:31:28 GMT]]></title><description><![CDATA[<p>Werde das Prog mal ausbessern!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084414</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sat, 24 Jun 2006 12:31:28 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sat, 24 Jun 2006 11:55:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">mitarbeiter *testmitarbeiter = new mitarbeiter[ 500 ];
</code></pre>
<p>Du legst hier ein Array von <em>mitarbeiter</em> an. Die *<em>testmitarbeiter</em> bekommt die Adresse des ersten neu erstellten <em>mitarbeiter</em>s.</p>
<p>Ein index beim zugriff auf <em>testmitarbeiter</em> wäre angebracht, denn wie soll dein Compiler wissem, welchen der 500 <em>mitarbeiter</em> du meinst? Also:</p>
<pre><code class="language-cpp">testmitarbeiter[ irgendein_index ].name_eingabe(na);
testmitarbeiter[ irgendein_index ].vorname_eingabe();
testmitarbeiter[ irgendein_index ].urlaubs_anspruch();
testmitarbeiter[ irgendein_index ].resturlaub_berechnung();
</code></pre>
<p>achja, lösch bitte deine <em>testmitarbeiter</em>, wenn du sie nicht mehr benötigst:</p>
<pre><code class="language-cpp">delete [] testmitarbeiter;
</code></pre>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084454</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sat, 24 Jun 2006 11:55:46 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sat, 24 Jun 2006 12:15:11 GMT]]></title><description><![CDATA[<blockquote>
<pre><code class="language-cpp">#include &lt;string.h&gt;
</code></pre>
</blockquote>
<p>auch daran wirst du wenig freude haben, wenn du die std::string benutzen willst. der notwendige header dafür ist</p>
<pre><code class="language-cpp">#include &lt;string&gt;
</code></pre>
<p>achtung, verwechslungsgefahr: &lt;string&gt; ist nicht das 'moderne' gegenstück zu string.h, welches in C die funktionen für C-style strings enthält; dafür gibt es den header &lt;cstring&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084473</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084473</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 24 Jun 2006 12:15:11 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 15:00:24 GMT]]></title><description><![CDATA[<p>Frage!<br />
Wie Liste ich aller Personen auf?</p>
<pre><code class="language-cpp">personen[i].ausgabe_daten();
</code></pre>
<p>Es sind z.B. 5 Personen gespeicher!</p>
<p>Und ich mmöchte, dass alle ausgegeben werden!</p>
<p>Geht das irgendwie mit i--??</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085198</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sun, 25 Jun 2006 15:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 15:36:54 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Benutz doch einfach eine Schleife:</p>
<pre><code class="language-cpp">for(unsingned int i=0; i&lt;5; ++i)
    personen[i].ausgabe_daten();
</code></pre>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085220</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 25 Jun 2006 15:36:54 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 15:50:22 GMT]]></title><description><![CDATA[<p>geht das nicht anders?<br />
ich soll daten bis 500 anlegen können!<br />
Aber er soll mir nur die ausgeben, die auch vorhanden sind!</p>
<p>z.B. mein i = 100 Einträge! Jetzt soll er mir die 100 ausgeben und nicht bis 500, da sie noch leer sind!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085229</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sun, 25 Jun 2006 15:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 16:00:05 GMT]]></title><description><![CDATA[<p>Hier mein Beispiel!</p>
<pre><code class="language-cpp">switch(eingabe)
  {	  
    case 1:
    {
	i++;
	personen[i].eingabe_daten();
	break;
        }
	case 3:
	{
	cout&lt;&lt;&quot;Bitte geben Sie den Index des Mitarbeiters ein!&quot;&lt;&lt;endl;
	cin&gt;&gt;index;
	personen[index].ausgabe_daten();
        system(&quot;Pause&quot;);
	break;
	}
	case 4:
        {       
	{
	personen[i].ausgabe_daten();
	}
	break;
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1085235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085235</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sun, 25 Jun 2006 16:00:05 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 16:05:59 GMT]]></title><description><![CDATA[<p><strong>Poste mal den komletten Sourcecode!</strong></p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085240</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sun, 25 Jun 2006 16:05:59 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 17:22:25 GMT]]></title><description><![CDATA[<p>Benutz doch einfach eine vector, dann haste alle deine Probleme gelöst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085284</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sun, 25 Jun 2006 17:22:25 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 19:47:23 GMT]]></title><description><![CDATA[<p>Leider kenne ich mich noch nicht so gut aus!</p>
<p>Hier mein Prog!</p>
<p>Die Auflistung aller Mitarbeiter funktioniert immer noch nicht! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Könntet ihr mir da mal weiterhelfen?</p>
<p>Wie mache ich das mit dem Datum?</p>
<p>Aufgabe:<br />
Jeder Mitarbeiter hat pro Jahr 30 Urlaubstage. Mitarbeiter, die zum 01.01, des laufenden Kalenderjahrs das 50 Lebensjahr vollendet haben, erhalten 32 Tage.</p>
<p>Man kann es als struct machen, aber da kenn ich mich noch nicht so gut aus!</p>
<p>Und wie lösche ich einen Mitarbeiter?</p>
<p>delete Mitarbeiter []; ???</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085303</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sun, 25 Jun 2006 19:47:23 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 17:53:57 GMT]]></title><description><![CDATA[<p>wie ist denn Datum definiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085309</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 25 Jun 2006 17:53:57 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 17:59:25 GMT]]></title><description><![CDATA[<p>Ganz normal z.B. 25.06.2006 !!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1085316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085316</guid><dc:creator><![CDATA[Nydro]]></dc:creator><pubDate>Sun, 25 Jun 2006 17:59:25 GMT</pubDate></item><item><title><![CDATA[Reply to Array on Sun, 25 Jun 2006 18:08:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">class Mitarbeiter
{
  private:
  string Name, Vorname; // Persoenliche Informationen
  int Urlaubstage;
  int Tage, Monate, Jahr;
  char Anspruch,j;  
  Datum Geburtsdatum; // Datum als struct     &lt;============= hier
  //int Resturlaub; // Anzahl restlicher Urlaubstage
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1085322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1085322</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 25 Jun 2006 18:08:46 GMT</pubDate></item></channel></rss>