<?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[Variablen mit fehlerhafter Untervariablenvertauschung]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Variablenstruktur erstellt(*.h-Datei):</p>
<pre><code>struct Col
{
    int Know[9];
    int Max;
    int Nr;
};

struct Row
{
    Col col[9];
};

struct Feld
{
    Row row[9];
};
</code></pre>
<p>Nun definiere ich eine Variable im allgemeinen <strong>main.cpp</strong> Bereich:</p>
<pre><code>Feld feld1;
</code></pre>
<p>Hier befindet sich nun das Fehlverhalten:</p>
<pre><code>int j,jj=3,row2=4,col2=1;
for(j=jj; j&lt;=9; j++)
{
   feld1.row[row2].col[col2].Know[j] = [b]9[/b];
}
//.Max=[b]9[/b]
feld1.row[row2].col[col2].Max -= 1;
//.Max=8
</code></pre>
<p>Egal welchen Wert die Variable <strong>feld1.row[row2].col[col2].Max</strong> hat,<br />
beträgt er vor dem Subtrahieren immer 9 und danach 8.</p>
<p>Ich habe andere Zahlen für <strong>&quot;.Know[j]&quot;</strong> eingegeben und diese hat <strong>&quot;.Max&quot;</strong> gleich mit übernommen?!</p>
<p>Was mache ich hier falsch?<br />
Da ich neu in <strong>C++</strong> bin und davor mit <strong>VB6</strong> gearbeitet habe,<br />
kenne ich bestimmt nicht alle Regeln,<br />
die beachtet werden sollten.</p>
<p>Vielen Dank fürs Aufklären <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="😉"
    /><br />
Jörg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/216716/variablen-mit-fehlerhafter-untervariablenvertauschung</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 06:05:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/216716.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 27 Jun 2008 12:58:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 12:58:54 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Variablenstruktur erstellt(*.h-Datei):</p>
<pre><code>struct Col
{
    int Know[9];
    int Max;
    int Nr;
};

struct Row
{
    Col col[9];
};

struct Feld
{
    Row row[9];
};
</code></pre>
<p>Nun definiere ich eine Variable im allgemeinen <strong>main.cpp</strong> Bereich:</p>
<pre><code>Feld feld1;
</code></pre>
<p>Hier befindet sich nun das Fehlverhalten:</p>
<pre><code>int j,jj=3,row2=4,col2=1;
for(j=jj; j&lt;=9; j++)
{
   feld1.row[row2].col[col2].Know[j] = [b]9[/b];
}
//.Max=[b]9[/b]
feld1.row[row2].col[col2].Max -= 1;
//.Max=8
</code></pre>
<p>Egal welchen Wert die Variable <strong>feld1.row[row2].col[col2].Max</strong> hat,<br />
beträgt er vor dem Subtrahieren immer 9 und danach 8.</p>
<p>Ich habe andere Zahlen für <strong>&quot;.Know[j]&quot;</strong> eingegeben und diese hat <strong>&quot;.Max&quot;</strong> gleich mit übernommen?!</p>
<p>Was mache ich hier falsch?<br />
Da ich neu in <strong>C++</strong> bin und davor mit <strong>VB6</strong> gearbeitet habe,<br />
kenne ich bestimmt nicht alle Regeln,<br />
die beachtet werden sollten.</p>
<p>Vielen Dank fürs Aufklären <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="😉"
    /><br />
Jörg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1536988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536988</guid><dc:creator><![CDATA[JörgLie]]></dc:creator><pubDate>Fri, 27 Jun 2008 12:58:54 GMT</pubDate></item><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 13:12:14 GMT]]></title><description><![CDATA[<p>ich verstehe die struktur nicht so recht...</p>
<pre><code class="language-cpp">struct Col //spalte
{
    int Know[9];
    int Max;
    int Nr;
};

struct Row //reihe
{
    Col col[9];
};

struct Feld //feld
{
    Row row[9];
};
</code></pre>
<p>Ein Feld hat also 9 reihen die jeweils 9 spalten haben? Oo<br />
Entweder, du hast nur die Namen unglücklich gewählt oder aber ich versteh hier iwas falsch...</p>
<pre><code class="language-cpp">struct cell
{
int value;
static int max;
size_t Nr;
};
struct row
{
cell Cell[9];
};
struct feld
{
row Row[9];
};
</code></pre>
<p>vll lieg ich ja richtig?</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1536997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536997</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 27 Jun 2008 13:12:14 GMT</pubDate></item><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 13:38:45 GMT]]></title><description><![CDATA[<p>Verpasse deinen Strukturen Konstruktoren, in denen die Membervariablen initialisiert werden, sonst steht dort immer irgendwas drin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537017</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 27 Jun 2008 13:38:45 GMT</pubDate></item><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 15:46:56 GMT]]></title><description><![CDATA[<p>Konstruktoren also ...</p>
<p>Naja die sind mir leider noch fremd.</p>
<p>Könnte wer vielleicht ein kurzes Beispiel zu meinem Code machen?<br />
Das wär zumindest eine sehr gute Hilfe <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>Danke<br />
Jörg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537078</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537078</guid><dc:creator><![CDATA[JörgLie]]></dc:creator><pubDate>Fri, 27 Jun 2008 15:46:56 GMT</pubDate></item><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 15:50:56 GMT]]></title><description><![CDATA[<p>Hier mal ein, bewußt etwas einfacher gehaltenes, Beispiel für einen Konstruktor der struct Col.</p>
<pre><code class="language-cpp">struct Col
{
    int Know[9];
    int Max;
    int Nr;
    Col() : Max(0), Nr(0)
    {
        for( int i=0; i&lt;9; ++i)
            Know[i] = 0;
    }
};
</code></pre>
<p>Siehe auch<br />
<a href="http://tutorial.schornboeck.net/konstruktor.htm" rel="nofollow">http://tutorial.schornboeck.net/konstruktor.htm</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537080</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 27 Jun 2008 15:50:56 GMT</pubDate></item><item><title><![CDATA[Reply to Variablen mit fehlerhafter Untervariablenvertauschung on Fri, 27 Jun 2008 15:54:30 GMT]]></title><description><![CDATA[<p>Vielen Dank Braunstein <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>Gruß<br />
Jörg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537083</guid><dc:creator><![CDATA[JörgLie]]></dc:creator><pubDate>Fri, 27 Jun 2008 15:54:30 GMT</pubDate></item></channel></rss>