<?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[Struct - Nachhilfe]]></title><description><![CDATA[<p>Guten Tag,<br />
ich glaube ich brauche etwas Nachhilfe was Structs angeht, denn irgendwie will ich das Prinzip einfach nicht verstehen.<br />
Am besten verdeutlich ich das an einem Beispiel:</p>
<p>struct familie<br />
{<br />
char name;<br />
char wohnort;<br />
bool haus<br />
int mitglieder;<br />
int familienklima;<br />
// . . .<br />
};</p>
<p>familie hat die variablen: meier, mueller, schneider</p>
<p>Ich habe mir das so gedacht: In einem Array wird die Familie gewählt und dann kann ich die Struct Elemente der jeweiligen Familie editieren.<br />
Allerdings funktioniert das nicht so ganz.</p>
<p>Ich hoffe man konnte mein Problem nachvollziehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/252296/struct-nachhilfe</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 05:43:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/252296.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Oct 2009 17:38:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 17:38:20 GMT]]></title><description><![CDATA[<p>Guten Tag,<br />
ich glaube ich brauche etwas Nachhilfe was Structs angeht, denn irgendwie will ich das Prinzip einfach nicht verstehen.<br />
Am besten verdeutlich ich das an einem Beispiel:</p>
<p>struct familie<br />
{<br />
char name;<br />
char wohnort;<br />
bool haus<br />
int mitglieder;<br />
int familienklima;<br />
// . . .<br />
};</p>
<p>familie hat die variablen: meier, mueller, schneider</p>
<p>Ich habe mir das so gedacht: In einem Array wird die Familie gewählt und dann kann ich die Struct Elemente der jeweiligen Familie editieren.<br />
Allerdings funktioniert das nicht so ganz.</p>
<p>Ich hoffe man konnte mein Problem nachvollziehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793917</guid><dc:creator><![CDATA[werda]]></dc:creator><pubDate>Sat, 17 Oct 2009 17:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 17:43:45 GMT]]></title><description><![CDATA[<p>werda schrieb:</p>
<blockquote>
<p>Ich hoffe man konnte mein Problem nachvollziehen.</p>
</blockquote>
<p>Nein.</p>
<p>Zumindest nicht, bis du konkreter als &quot;funktioniert nicht so ganz&quot; wirst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793921</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 17 Oct 2009 17:43:45 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 17:46:03 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>1. bitte benutze cpp tags (button unter den smilys)</p>
<p>bitte werde etwas genauer mit deiner anfrage. so wie es aussieht hast du aber ein grundsätzliches verständnissproblem bei structs</p>
<p>eine struct ist eine sammlung von eigenschaften EINES Objektes</p>
<p>also ein struct familie bsp die eigenschaften</p>
<pre><code class="language-cpp">familie eins;
eins.name='a';//ein char ist nämlich genau EIN Zeichen!!
eins.haus=true;
....
familie arr[3];//in einem array eingesetzt
arr[0].name='b'
</code></pre>
<p>mehrere dieser structs kannst du natürlich auch in einem array speichern.</p>
<p>allerdings würde ich dir empfehlen dir nochmals die grundlagen von C++ anzuschauen. aus der benutzung von structs und char schließe ich das da eventuell noch etwas nachholbedarf ist. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1793922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793922</guid><dc:creator><![CDATA[Fencer]]></dc:creator><pubDate>Sat, 17 Oct 2009 17:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 18:36:58 GMT]]></title><description><![CDATA[<p>char ist ein Datentyp, der nur ein einzelnes Zeichen speichert (steht schließlich für <em>char</em>acter). Du benötigst in deinem Fall string.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793938</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Sat, 17 Oct 2009 18:36:58 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 19:53:41 GMT]]></title><description><![CDATA[<p>ohh, ich glaube ich wurde etwas missverstanden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Ich habe kein C++ tag benutzt, weil mein Code lediglich eine Art 'Skizze' war, deshalb ist das auch nicht ganz korrekt, was das &quot;char&quot; angeht (ich weiß ich müsste eigentlich</p>
<pre><code class="language-cpp">char abc[100]
</code></pre>
<p>z.b schreiben)</p>
<p>Das, was nicht so funktioniert, war mein Versuch auf eine Lösung zu kommen. Ich hatte kein Problem als es nur um eine &quot;Familie&quot; ging, sobald aber mehr dazu kamen, bin ich auf keinen logischen Ansatz mehr gekommen.</p>
<p>Danke allen für die rasche Hilfe. Ich werde mir mal das, was Fencer gepostet hat, genauer ansehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793971</guid><dc:creator><![CDATA[werda]]></dc:creator><pubDate>Sat, 17 Oct 2009 19:53:41 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 19:58:06 GMT]]></title><description><![CDATA[<p>Wird familienklima eigentlich in Grad oder in Celsius angegeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793974</guid><dc:creator><![CDATA[SehrJei]]></dc:creator><pubDate>Sat, 17 Oct 2009 19:58:06 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sat, 17 Oct 2009 20:04:06 GMT]]></title><description><![CDATA[<p>SehrJei schrieb:</p>
<blockquote>
<p>Wird familienklima eigentlich in Grad oder in Celsius angegeben?</p>
</blockquote>
<p>Wenn schon, dann in Grad Celsius.</p>
<p>@ OP: wenn du keinen guten Grund dagegen hast, müsstest du string abc; schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1793980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1793980</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Sat, 17 Oct 2009 20:04:06 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 18 Oct 2009 10:43:04 GMT]]></title><description><![CDATA[<p>Hm, also irgendwie mache ich noch irgendwas falsch. Ich glaube es liegt daran, wo und wann ich das Struct und seine Elemente deklariere.<br />
Ich habe eine Headerdatei mit allen Variablen etc. dort wird mein Struct und seine Elemente definiert. Die Variable zu diesem Struct wird ebenfalls dort deklariert.<br />
Wenn ich nun mein Struct ebenfalls in dieser Headerdatei &quot;befülle&quot;, bekomme ich eine Menge Fehler. z.B &quot;Fehlender Typspezifizierer - int wird angenommen.&quot; oder dass ich ein &quot;;&quot; vergessen hätte etc.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794135</guid><dc:creator><![CDATA[werda]]></dc:creator><pubDate>Sun, 18 Oct 2009 10:43:04 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 18 Oct 2009 11:03:10 GMT]]></title><description><![CDATA[<p>werda schrieb:</p>
<blockquote>
<p>Hm, also irgendwie mache ich noch irgendwas falsch. Ich glaube es liegt daran, wo und wann ich das Struct und seine Elemente deklariere.<br />
Ich habe eine Headerdatei mit allen Variablen etc. dort wird mein Struct und seine Elemente definiert. Die Variable zu diesem Struct wird ebenfalls dort deklariert.<br />
Wenn ich nun mein Struct ebenfalls in dieser Headerdatei &quot;befülle&quot;, bekomme ich eine Menge Fehler. z.B &quot;Fehlender Typspezifizierer - int wird angenommen.&quot; oder dass ich ein &quot;;&quot; vergessen hätte etc.</p>
</blockquote>
<p>Das hört sich ein bisschen wirr an, wie du die Begriffe Definition und Deklaration hier verwendest. Außerdem ist es nicht ganz der Zweck einer Headerdatei, dass dort Sachen 'befüllt' werden. Zeig am besten mal den Code her.</p>
<p>Die Fehlermeldung klingt danach, als hättest du einen Syntaxfehler der Definition deiner struct-Instanz gemacht. Genau kann man das erst sagen, wenn man den Code sieht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794142</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 18 Oct 2009 11:03:10 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 18 Oct 2009 11:14:58 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct familie
{
string name;
string wohnort;
bool haus;
int familienklima;
int mitglieder;
};
</code></pre>
<p>dann die variable:</p>
<pre><code class="language-cpp">familie fam[2];
</code></pre>
<p>hier das &quot;befüllen&quot;:</p>
<pre><code class="language-cpp">fam[0].name = &quot;Maier&quot;;
fam[0].wohnort = &quot;Hier&quot;;
fam[0].haus = false;
fam[0].familienklima = 0;
fam[0].mitglieder = 2;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1794147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794147</guid><dc:creator><![CDATA[werda]]></dc:creator><pubDate>Sun, 18 Oct 2009 11:14:58 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 18 Oct 2009 15:42:35 GMT]]></title><description><![CDATA[<p>Das ist richtig, insofern:<br />
a) Der Compiler weiß, was string ist: Möglicherweise include vergessen? Daran gedacht, dass string im Namespace std ist?<br />
b) Die Wertzuweisungen sich innerhalb eines Codeblocks befinden</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794268</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 18 Oct 2009 15:42:35 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 18 Oct 2009 19:41:04 GMT]]></title><description><![CDATA[<p>Ich vermute es liegt an b).</p>
<p>Ich möchte die Wertezuweisung nämlich gerne global haben. Heißt das findet außerhalb eines Codeblocks statt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794423</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794423</guid><dc:creator><![CDATA[werda]]></dc:creator><pubDate>Sun, 18 Oct 2009 19:41:04 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Mon, 19 Oct 2009 13:55:06 GMT]]></title><description><![CDATA[<p>Dann einfach dafür die Struktur-Initialisierung verwenden:</p>
<pre><code class="language-cpp">familie fam[2] =
{
  { &quot;Maier&quot;, &quot;Hier&quot;, false, 0, 2 },
  { &quot;Maier Zwo&quot;, &quot;Dort&quot;, true, 1, 3 }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1794839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794839</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Mon, 19 Oct 2009 13:55:06 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Mon, 19 Oct 2009 14:43:51 GMT]]></title><description><![CDATA[<p>Bei deiner Struct definition ist kein typedef angegeben, demnach müsste es heissen</p>
<pre><code class="language-cpp">struct familie fam[3];
</code></pre>
<p>oder du machst</p>
<pre><code class="language-cpp">typedef struct
{
string name;
string wohnort;
bool haus;
int familienklima;
int mitglieder;
}familie;

//dann klappt auch
familie fam[3];
</code></pre>
<p>oder bin ich jetzt falsch?</p>
<p>Gruß,<br />
Sascha</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794878</guid><dc:creator><![CDATA[_Sascha_]]></dc:creator><pubDate>Mon, 19 Oct 2009 14:43:51 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Mon, 19 Oct 2009 14:45:18 GMT]]></title><description><![CDATA[<p><em>Sascha</em> schrieb:</p>
<blockquote>
<p>...</p>
</blockquote>
<p>Wir sind hier im C++ Unterforum und nicht im C-Teil...</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794881</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Mon, 19 Oct 2009 14:45:18 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Mon, 19 Oct 2009 14:48:07 GMT]]></title><description><![CDATA[<p><em>Sascha</em> schrieb:</p>
<blockquote>
<p>Oder bin ich jetzt falsch?</p>
<p>Gruß,<br />
Sascha</p>
</blockquote>
<p>Jau. In C++ braucht man das typedef nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794882</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Mon, 19 Oct 2009 14:48:07 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Tue, 20 Oct 2009 09:32:25 GMT]]></title><description><![CDATA[<p>unskilled schrieb:</p>
<blockquote>
<p><em>Sascha</em> schrieb:</p>
<blockquote>
<p>...</p>
</blockquote>
<p>Wir sind hier im C++ Unterforum und nicht im C-Teil...<br />
bb</p>
</blockquote>
<p>oh...stimmt! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Sorry!</p>
<p><strong>aber...</strong></p>
<p>werda schrieb:</p>
<blockquote>
<p>... bekomme ich eine Menge Fehler. z.B &quot;Fehlender Typspezifizierer - int wird angenommen.&quot; oder dass ich ein &quot;;&quot; vergessen hätte etc.</p>
</blockquote>
<p>evtl hat er isn falsche unterforum geschrieben. <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="😕"
    /><br />
Die Fehlermeldungen klingen für mich nach C ...</p>
<p>Sascha</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1794883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1794883</guid><dc:creator><![CDATA[_Sascha_]]></dc:creator><pubDate>Tue, 20 Oct 2009 09:32:25 GMT</pubDate></item><item><title><![CDATA[Reply to Struct - Nachhilfe on Sun, 25 Oct 2009 16:46:06 GMT]]></title><description><![CDATA[<blockquote>
<pre><code class="language-cpp">fam[0].familienklima = 0;
</code></pre>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798098</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798098</guid><dc:creator><![CDATA[oO]]></dc:creator><pubDate>Sun, 25 Oct 2009 16:46:06 GMT</pubDate></item></channel></rss>