<?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[Anfaengerfrage]]></title><description><![CDATA[<p>Hi, hab hier ein kleines Problem. Unzwar werden bei der Ausgabe keine geraden Zahlen berücksichtigt. Stattdessen wird 0 angezeigt. Wenn man in der ersten Schleife realfeld[0][++y] = y eingibt, klappt alles wunderbar</p>
<pre><code>const int breite = 9;
const int hoehe = 9;

struct spielfeld {
int zahl;
};

spielfeld realfeld[breite][hoehe];

for (int y=0; y &lt;hoehe-1; y++) {
	for (int x=0; x &lt;breite-1; x++) {	
	realfeld[++x][0].zahl = x;
    	}
    }

	for (int x=0; x&lt;breite; x++)	{
		for (int y=0; y&lt;hoehe; y++)	{
cout &lt;&lt; realfeld [x][y].zahl;
		}
		cout &lt;&lt; endl;
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/321286/anfaengerfrage</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 18:24:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/321286.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 30 Oct 2013 22:24:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfaengerfrage on Wed, 30 Oct 2013 22:27:09 GMT]]></title><description><![CDATA[<p>Hi, hab hier ein kleines Problem. Unzwar werden bei der Ausgabe keine geraden Zahlen berücksichtigt. Stattdessen wird 0 angezeigt. Wenn man in der ersten Schleife realfeld[0][++y] = y eingibt, klappt alles wunderbar</p>
<pre><code>const int breite = 9;
const int hoehe = 9;

struct spielfeld {
int zahl;
};

spielfeld realfeld[breite][hoehe];

for (int y=0; y &lt;hoehe-1; y++) {
	for (int x=0; x &lt;breite-1; x++) {	
	realfeld[++x][0].zahl = x;
    	}
    }

	for (int x=0; x&lt;breite; x++)	{
		for (int y=0; y&lt;hoehe; y++)	{
cout &lt;&lt; realfeld [x][y].zahl;
		}
		cout &lt;&lt; endl;
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2364015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364015</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Wed, 30 Oct 2013 22:27:09 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Wed, 30 Oct 2013 22:40:21 GMT]]></title><description><![CDATA[<pre><code>realfeld[++x][0].zahl = x;
</code></pre>
<p>Erklär mal, was du dir davon erhoffst. Diese Zeile macht das, was du beschreibst. Aber anscheinend ist das nicht deine Absicht. Jedoch weiß ich nicht, was deine Absicht überhaupt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364021</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 30 Oct 2013 22:40:21 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 08:06:45 GMT]]></title><description><![CDATA[<p>Hi, die erste (senkrechte) Zeile soll alle Zahlen von 0-8 anzeigen. Das was sie aber anzeigt ist 010305070. Warum werden keine geraden Zahlen angezeigt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364047</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364047</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Thu, 31 Oct 2013 08:06:45 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 08:11:42 GMT]]></title><description><![CDATA[<p>Wie oft erhòhst du denn x?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364048</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Thu, 31 Oct 2013 08:11:42 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 08:52:52 GMT]]></title><description><![CDATA[<p>Naja 8 mal also von 0-7, willst du darauf hinaus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364049</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364049</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Thu, 31 Oct 2013 08:52:52 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 09:40:23 GMT]]></title><description><![CDATA[<p>Wie oft erhöhst du x pro Schleifendurchgang?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364050</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364050</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Thu, 31 Oct 2013 09:40:23 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 09:27:44 GMT]]></title><description><![CDATA[<p>Also die Schleifen tauschen? X zuerst? Das klappt. Darauf wolltest du auch hinaus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364055</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364055</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Thu, 31 Oct 2013 09:27:44 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 09:40:05 GMT]]></title><description><![CDATA[<p>Nein, darauf wollte ich nicht hinaus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364057</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364057</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Thu, 31 Oct 2013 09:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 10:00:42 GMT]]></title><description><![CDATA[<p>kamelkacke schrieb:</p>
<blockquote>
<p>realfeld[++x][0].zahl = x;</p>
</blockquote>
<p>Da es noch keiner gesagt hat: <strong>UB</strong><br />
(<a href="https://en.wikipedia.org/wiki/Undefined_behavior" rel="nofollow">undefined behaviour</a>)</p>
<p>Innerhalb desselben Ausdrucks, beziehst du dich auf x 2mal, wobei das eine auch ein Schreibzugriff ist. Weder das eine noch das andere muss vor dem jeweils anderen passieren (unsequenced). Das Verhalten davon ist nicht definiert.</p>
<p>Und sonst: Probier es doch mal mit einem Debugger.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364061</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Thu, 31 Oct 2013 10:00:42 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 12:25:20 GMT]]></title><description><![CDATA[<p>Worauf Nathan heraus wollte:<br />
Du erhöhst x in der for-Schleife Zeile 11 und in der Anweisung Zeile 12, also 2 Mal. Wenn man jedes Mal um 2 erhöht und bei 0 anfängt kommen halt genau die geraden Zahlen raus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364081</guid><dc:creator><![CDATA[nwp3]]></dc:creator><pubDate>Thu, 31 Oct 2013 12:25:20 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 12:27:53 GMT]]></title><description><![CDATA[<p>Zudem ist die eine Schleife unnötig, da du y ja nie benutzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364083</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Thu, 31 Oct 2013 12:27:53 GMT</pubDate></item><item><title><![CDATA[Reply to Anfaengerfrage on Thu, 31 Oct 2013 17:31:26 GMT]]></title><description><![CDATA[<p>Ok, Problem geloest, vielen Dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2364130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2364130</guid><dc:creator><![CDATA[kamelkacke]]></dc:creator><pubDate>Thu, 31 Oct 2013 17:31:26 GMT</pubDate></item></channel></rss>