<?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[the variable chspielmode is being used without being initialized]]></title><description><![CDATA[<p>Hi,<br />
ich habe gerade erst angefangen zu programmieren und bin auch neu in diesem Forum (ich hoffe das ist der richtige Bereich für mein Thema). Ich habe eine Fehlermeldung bekommen, mit der ich nichts anzufangen weiß: &quot;Run-Time Check Failure #3 - The variable chspielmode is being used without being initialized&quot;. Die kommt leider erst wenn ich das Programm starte, es passiert wenn ich 1 Player oder 0 angebe. Hier mein Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

//Hauptprogramm
int main ()
{
	//Variablen
	int spieleranzahl;
	char chspielmode;

	//Spieleranzahl eingeben lassen 
	cout &lt;&lt; &quot;Wie viele Spieler? &quot; &lt;&lt; endl;
	cin &gt;&gt; spieleranzahl;

	//Spieleranzahl ungültig
	if (spieleranzahl == 0)
		cout &lt;&lt; &quot;Falsche Eingabe, bitte neustarten!&quot; &lt;&lt; endl;
	//Spierleranzahl 1
	else if (spieleranzahl == 1)
		cout &lt;&lt; &quot;Spiel gegen den Computer\n&quot;;
	//Spieleranzahl mehr als 1
	else
	{
		cout &lt;&lt; &quot;Multiplayerspiel\n&quot;;
		cout &lt;&lt; &quot;(t)eamspiel oder (f)ree for all?\n&quot;;
		cin &gt;&gt; chspielmode;
	}

	//Teamspiel
	if (chspielmode == 't')
		cout &lt;&lt; &quot;Teamspiel, Spiel wird geladen...\a\n&quot;;
	//Free for All
	else if (chspielmode == 'f')
		cout &lt;&lt; &quot;Free for All, Spiel wird geladen...\a\n&quot;;
	//Falsche Eingabe
	else
		cout &lt;&lt; &quot;Falsche Eingabe, bitte neustarten&quot; &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>Ich hoffe ihr könnt mir helfen.<br />
LG</p>
<p><em>/edit pumuckl: bb-codes und damit cpp-tags aktiviert</em></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/269342/the-variable-chspielmode-is-being-used-without-being-initialized</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 06:03:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/269342.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Jun 2010 11:24:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to the variable chspielmode is being used without being initialized on Wed, 23 Jun 2010 13:59:02 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich habe gerade erst angefangen zu programmieren und bin auch neu in diesem Forum (ich hoffe das ist der richtige Bereich für mein Thema). Ich habe eine Fehlermeldung bekommen, mit der ich nichts anzufangen weiß: &quot;Run-Time Check Failure #3 - The variable chspielmode is being used without being initialized&quot;. Die kommt leider erst wenn ich das Programm starte, es passiert wenn ich 1 Player oder 0 angebe. Hier mein Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

//Hauptprogramm
int main ()
{
	//Variablen
	int spieleranzahl;
	char chspielmode;

	//Spieleranzahl eingeben lassen 
	cout &lt;&lt; &quot;Wie viele Spieler? &quot; &lt;&lt; endl;
	cin &gt;&gt; spieleranzahl;

	//Spieleranzahl ungültig
	if (spieleranzahl == 0)
		cout &lt;&lt; &quot;Falsche Eingabe, bitte neustarten!&quot; &lt;&lt; endl;
	//Spierleranzahl 1
	else if (spieleranzahl == 1)
		cout &lt;&lt; &quot;Spiel gegen den Computer\n&quot;;
	//Spieleranzahl mehr als 1
	else
	{
		cout &lt;&lt; &quot;Multiplayerspiel\n&quot;;
		cout &lt;&lt; &quot;(t)eamspiel oder (f)ree for all?\n&quot;;
		cin &gt;&gt; chspielmode;
	}

	//Teamspiel
	if (chspielmode == 't')
		cout &lt;&lt; &quot;Teamspiel, Spiel wird geladen...\a\n&quot;;
	//Free for All
	else if (chspielmode == 'f')
		cout &lt;&lt; &quot;Free for All, Spiel wird geladen...\a\n&quot;;
	//Falsche Eingabe
	else
		cout &lt;&lt; &quot;Falsche Eingabe, bitte neustarten&quot; &lt;&lt; endl;

	return 0;
}
</code></pre>
<p>Ich hoffe ihr könnt mir helfen.<br />
LG</p>
<p><em>/edit pumuckl: bb-codes und damit cpp-tags aktiviert</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1916229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1916229</guid><dc:creator><![CDATA[tietze111]]></dc:creator><pubDate>Wed, 23 Jun 2010 13:59:02 GMT</pubDate></item><item><title><![CDATA[Reply to the variable chspielmode is being used without being initialized on Wed, 23 Jun 2010 11:51:51 GMT]]></title><description><![CDATA[<p>Hi,<br />
du solltest deine Englischkenntisse auffrischen.<br />
Die Fehlermeldung sagt doch sehr genau, was nicht passt:</p>
<p>'chspielmode' wird benutzt, ohne das sie vorher initialisiert wurde.<br />
Das liegt daran, dass das Programm nicht zwingend diesen Teil</p>
<pre><code class="language-cpp">else
{
cout &lt;&lt; &quot;Multiplayerspiel\n&quot;;
cout &lt;&lt; &quot;(t)eamspiel oder (f)ree for all?\n&quot;;
cin &gt;&gt; chspielmode;
}
</code></pre>
<p>durchläuft und chspielmode sonst nicht gesetzt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1916249</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1916249</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Wed, 23 Jun 2010 11:51:51 GMT</pubDate></item><item><title><![CDATA[Reply to the variable chspielmode is being used without being initialized on Thu, 24 Jun 2010 18:11:06 GMT]]></title><description><![CDATA[<p>Achso, danke, ich hab das nicht gesehen, ich musste eine Verschachtelung machen, ist mir jetzt dadurch aufgefallen, tut mir leid^^ ich bin noch Anfänger und hab nich dran gedacht :(. Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1916924</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1916924</guid><dc:creator><![CDATA[tietze111]]></dc:creator><pubDate>Thu, 24 Jun 2010 18:11:06 GMT</pubDate></item></channel></rss>