<?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[HILFE!!! Kategorisierungsproblem!]]></title><description><![CDATA[<p>Hey C++ Community,</p>
<p>ich hab ein kleines Problem mit der Kategorisierung bzw. mit der Abrufung der Kategorisierung in C++. Bevor ich lange versuch es in Worten zu beschreiben, hier mein Programm:</p>
<pre><code class="language-cpp">if (GPS_Height[i]+3 &lt; GPS_Height[i+1])
		{
			kat[i]=1;
		}
		else
		{
			if (GPS_Height[i]-3 &gt; GPS_Height[i+1])
			{
				kat[i]=-1;
			}

			else
			{
				kat[i]=0;
			}

		}
	}
		for (int i=0; i&lt;221; i++)
	{

		if (kat[i] = 0)
		{
			anzahl_n = anzahl_n + 1;
		}
		if (kat[i] = 1)
		{
			anzahl_p = anzahl_p + 1;
		}
		if (kat[i] = -1)
		{
			anzahl_m = anzahl_m + 1;
		}
		cout &lt;&lt; &quot;anzahl_n: &quot; &lt;&lt; anzahl_n &lt;&lt; endl &lt;&lt; &quot;anzahl_p: &quot; &lt;&lt; anzahl_p &lt;&lt; endl &lt;&lt; &quot;anzahl_m: &quot; &lt;&lt; anzahl_m &lt;&lt; endl;
	}
</code></pre>
<p>Bei der Ausgabe wird mir für anzahl_n immer &quot;0&quot; ausgegeben, bei den anderen beiden, anzahl_m und anzahl_p zählt er synchron aufwärts, was er nicht soll.</p>
<p>Weiß jemand wie ich die Bereiche/Kategorien zählen kann?</p>
<p>Am Rande: Ich studier im ersten Semester Informatik... Also bitte nicht gleich auseinandernehmen <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>Hoffentlich kann mir jemand Helfen.</p>
<p>Grüße</p>
<p>m00gle</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/226102/hilfe-kategorisierungsproblem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 03:24:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/226102.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Oct 2008 14:27:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:27:53 GMT]]></title><description><![CDATA[<p>Hey C++ Community,</p>
<p>ich hab ein kleines Problem mit der Kategorisierung bzw. mit der Abrufung der Kategorisierung in C++. Bevor ich lange versuch es in Worten zu beschreiben, hier mein Programm:</p>
<pre><code class="language-cpp">if (GPS_Height[i]+3 &lt; GPS_Height[i+1])
		{
			kat[i]=1;
		}
		else
		{
			if (GPS_Height[i]-3 &gt; GPS_Height[i+1])
			{
				kat[i]=-1;
			}

			else
			{
				kat[i]=0;
			}

		}
	}
		for (int i=0; i&lt;221; i++)
	{

		if (kat[i] = 0)
		{
			anzahl_n = anzahl_n + 1;
		}
		if (kat[i] = 1)
		{
			anzahl_p = anzahl_p + 1;
		}
		if (kat[i] = -1)
		{
			anzahl_m = anzahl_m + 1;
		}
		cout &lt;&lt; &quot;anzahl_n: &quot; &lt;&lt; anzahl_n &lt;&lt; endl &lt;&lt; &quot;anzahl_p: &quot; &lt;&lt; anzahl_p &lt;&lt; endl &lt;&lt; &quot;anzahl_m: &quot; &lt;&lt; anzahl_m &lt;&lt; endl;
	}
</code></pre>
<p>Bei der Ausgabe wird mir für anzahl_n immer &quot;0&quot; ausgegeben, bei den anderen beiden, anzahl_m und anzahl_p zählt er synchron aufwärts, was er nicht soll.</p>
<p>Weiß jemand wie ich die Bereiche/Kategorien zählen kann?</p>
<p>Am Rande: Ich studier im ersten Semester Informatik... Also bitte nicht gleich auseinandernehmen <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>Hoffentlich kann mir jemand Helfen.</p>
<p>Grüße</p>
<p>m00gle</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606656</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606656</guid><dc:creator><![CDATA[m00gle]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:27:53 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:30:19 GMT]]></title><description><![CDATA[<p>Bitte rücke nächstes Mal ein wenig sauberer ein.</p>
<p>Du verwendest als Vergleichsoperator <code>=</code> , das mathematische Gleichheitszeichen entspricht in C++ aber <code>==</code> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606657</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:30:19 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:37:01 GMT]]></title><description><![CDATA[<p>erstmal danke für die schnelle antwort und sorry fürs falsche Format.</p>
<p>nach dem ich den vergleichsoperator geändert hab, gibt er mir für jeden anzahl_x wert &quot;0&quot; aus...</p>
<p>wüsstest du was das sein kann?</p>
<p>greetz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606663</guid><dc:creator><![CDATA[m00gle]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:37:01 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:41:50 GMT]]></title><description><![CDATA[<p>Zeig doch mal den ganzen Part, korrekt eingerückt. Da fehlt oben doch schon einmal mindestens eine Schleife. Desweiteren empfiehlt es sich auch mal sowas wie <strong>}else if(...){</strong> zu verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606667</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:41:50 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:45:06 GMT]]></title><description><![CDATA[<p>Wahrscheinlich treffen die If-Bedingungen nicht ein und so werden die Variablen nicht erhöht. Ich kann aber nur raten, ohne mehr über den Code zu wissen. Das könntest du aber auch im Debugger oder mit <code>std::cout</code> -Statements herausfinden.</p>
<p>Übrigens, um eine Variable zu inkrementieren gibt es den <code>operator++</code> :</p>
<pre><code class="language-cpp">int i = 0;
++i; // i ist 1, Ausdruck hat auch den Wert 1.
i++; // i ist 2, Ausdruck hat aber noch den Wert 1 (Inkrementierung wird erst danach ausgewertet).
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1606672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606672</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:45:06 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:45:22 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int _tmain(int argc, _TCHAR* argv[])
{
	double E1, N1,  E2, N2;
	double a, b;
	double dist;
	int anzahl_n=0;
	int anzahl_m=0;
	int anzahl_p=0;

	int kat[221];

	for (int i=1; i&lt;221; i++)
	{
	LL2UTM(GPS_Lat[i], GPS_Lon[i], E1, N1);
	LL2UTM(GPS_Lat[i-1], GPS_Lon[i-1], E2, N2);
	a = E1-E2;
	b = N1-N2;
	dist = sqrt(a*a+b*b);

		if (GPS_Height[i]+3 &lt; GPS_Height[i+1])
		{
			kat[i]==1;
		}
		else
		{
			if (GPS_Height[i]-3 &gt; GPS_Height[i+1])
			{
				kat[i]==-1;
			}

			else
			{
				kat[i]==0;
			}

		}
	}
		for (int i=0; i&lt;221; i++)
	{

		if (kat[i] == 0)
		{
			anzahl_n = anzahl_n + 1;
		}
		if (kat[i] = 1)
		{
			anzahl_p == anzahl_p + 1;
		}
		if (kat[i] == -1)
		{
			anzahl_m = anzahl_m + 1;
		}
		cout &lt;&lt; &quot;anzahl_n: &quot; &lt;&lt; anzahl_n &lt;&lt; endl &lt;&lt; &quot;anzahl_p: &quot; &lt;&lt; anzahl_p &lt;&lt; endl &lt;&lt; &quot;anzahl_m: &quot; &lt;&lt; anzahl_m &lt;&lt; endl;
	}

	return 0;
}
</code></pre>
<p>ich wüsst nich was ich anders einrücken soll <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="😕"
    /></p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606673</guid><dc:creator><![CDATA[m00gle]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:45:22 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:48:35 GMT]]></title><description><![CDATA[<p>m00gle schrieb:</p>
<blockquote>
<pre><code class="language-cpp">// In der nächsten Zeile sprengst du die Grenzen des Arrays dank i + 1
		if (GPS_Height[i]+3 &lt; GPS_Height[i+1])
		{
			kat[i]==1;
		}
		else
		{
// Hier ebenso
			if (GPS_Height[i]-3 &gt; GPS_Height[i+1])
			{
// Hier ist = der richtige Operator, nicht ==
				kat[i]==-1;
			}
			
			else
			{
// Hier ist = der richtige Operator, nicht ==
				kat[i]==0;
			}
		
		}
	}
		for (int i=0; i&lt;221; i++)
	{

		if (kat[i] == 0)
		{
			anzahl_n = anzahl_n + 1;
		}
// Hier ist == der richtige Operator, nicht =
		if (kat[i] = 1)
		{
// Hier ist = der richtige Operator, nicht ==
			anzahl_p == anzahl_p + 1;
		}
		if (kat[i] == -1)
		{
			anzahl_m = anzahl_m + 1;
		}
		cout &lt;&lt; &quot;anzahl_n: &quot; &lt;&lt; anzahl_n &lt;&lt; endl &lt;&lt; &quot;anzahl_p: &quot; &lt;&lt; anzahl_p &lt;&lt; endl &lt;&lt; &quot;anzahl_m: &quot; &lt;&lt; anzahl_m &lt;&lt; endl;
	}

	return 0;
}
</code></pre>
<p>ich wüsst nich was ich anders einrücken soll <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="😕"
    /></p>
<p>grüße</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1606676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606676</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:48:35 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:49:23 GMT]]></title><description><![CDATA[<p>m00gle schrieb:</p>
<blockquote>
<p>ich wüsst nich was ich anders einrücken soll <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="😕"
    /></p>
</blockquote>
<p>Normalerweise fügt man nach jeder öffnenden geschweiften Klammer eines Blocks eine Einrückung ein. Hast du z.B. innerhalb der ersten For-Schleife und im Schleifenkopf der zweiten For-Schleife missachtet.</p>
<p>Was soll das?</p>
<pre><code class="language-cpp">if (kat[i] = 1) 
        { 
            anzahl_p == anzahl_p + 1; 
        }
</code></pre>
<p>Gibt es einen Grund, nicht das normale <code>main()</code> zu verwenden?</p>
<p>Lies vielleicht nochmal meinen oberen Thread...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606680</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:49:23 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE!!! Kategorisierungsproblem! on Wed, 29 Oct 2008 14:59:34 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12954">@nexus</a>: das hatte ich falsch geändert, flüchtigkeitsfehler, sorry...</p>
<p>jetzt funktioniert das programm einwandfrei....</p>
<p>danke an alle...</p>
<p>grüße</p>
<p>m00gle</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606692</guid><dc:creator><![CDATA[m00gle]]></dc:creator><pubDate>Wed, 29 Oct 2008 14:59:34 GMT</pubDate></item></channel></rss>