<?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[while-Schleife wird nur einmal &amp;quot;geöffnet&amp;quot; [gelöst]]]></title><description><![CDATA[<p>Hallo zusammen.</p>
<p>Als erstes möchte ich mich bei allen im c++ Forum für die hilfreichen Beiträge bedanken, hab dadurch schon so manchen Fehler beheben können.</p>
<p>Nun zu meinem Problem. (Hoffe das ist das richtige Forum)</p>
<p>Ich möchte eine Passwortabfrage programmieren, in der das Passwort nicht sichtbar eingegeben wird, sondern als sternchen und in der man 3 versuche hat</p>
<p>Über _getch()und _putch('*') funktioniert es ja, nur leider immer nur beim ersten Versuch.</p>
<p>Hier der Code:</p>
<pre><code class="language-cpp">while (ianzahl&lt;=3)
{
	ceingabe = ' ';
	ceingabe = _getch();

	//Eingabe und &quot;umwandlung&quot; von char nach string
        while(ceingabe != char(0x0D) &amp;&amp; i &lt; 9)
	{
		_putch('*');
		streingabe += ceingabe;
		ceingabe = _getch();
	}		

	//passwortueberpruefung
	if (streingabe == strpassw)
	{
		ianzahl = 4;
		cout&lt;&lt;&quot;erfolg&quot;;
	}
	else
	{
		streingabe= &quot;&quot;;
		ianzahl++;
		cout&lt;&lt;endl&lt;&lt;&quot;misserfolg&quot;;
	}
}
</code></pre>
<p>Im voraus schon einmal danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/279549/while-schleife-wird-nur-einmal-quot-geöffnet-quot-gelöst</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 13:29:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/279549.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Dec 2010 08:05:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to while-Schleife wird nur einmal &amp;quot;geöffnet&amp;quot; [gelöst] on Wed, 29 Dec 2010 10:16:26 GMT]]></title><description><![CDATA[<p>Hallo zusammen.</p>
<p>Als erstes möchte ich mich bei allen im c++ Forum für die hilfreichen Beiträge bedanken, hab dadurch schon so manchen Fehler beheben können.</p>
<p>Nun zu meinem Problem. (Hoffe das ist das richtige Forum)</p>
<p>Ich möchte eine Passwortabfrage programmieren, in der das Passwort nicht sichtbar eingegeben wird, sondern als sternchen und in der man 3 versuche hat</p>
<p>Über _getch()und _putch('*') funktioniert es ja, nur leider immer nur beim ersten Versuch.</p>
<p>Hier der Code:</p>
<pre><code class="language-cpp">while (ianzahl&lt;=3)
{
	ceingabe = ' ';
	ceingabe = _getch();

	//Eingabe und &quot;umwandlung&quot; von char nach string
        while(ceingabe != char(0x0D) &amp;&amp; i &lt; 9)
	{
		_putch('*');
		streingabe += ceingabe;
		ceingabe = _getch();
	}		

	//passwortueberpruefung
	if (streingabe == strpassw)
	{
		ianzahl = 4;
		cout&lt;&lt;&quot;erfolg&quot;;
	}
	else
	{
		streingabe= &quot;&quot;;
		ianzahl++;
		cout&lt;&lt;endl&lt;&lt;&quot;misserfolg&quot;;
	}
}
</code></pre>
<p>Im voraus schon einmal danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1999870</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1999870</guid><dc:creator><![CDATA[Tal Ker]]></dc:creator><pubDate>Wed, 29 Dec 2010 10:16:26 GMT</pubDate></item><item><title><![CDATA[Reply to while-Schleife wird nur einmal &amp;quot;geöffnet&amp;quot; [gelöst] on Wed, 29 Dec 2010 10:08:19 GMT]]></title><description><![CDATA[<p>Wie initialisierst du <code>ianzahl</code> ?</p>
<p>Ist dir klar, dass die Bedingung <code>i &lt; 9</code> die Schleife nie abbrechen wird, weil i nicht hochgezählt wird? Außerdem wird <code>i</code> vor der Schleife nicht auf 0 gesetzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1999894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1999894</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Wed, 29 Dec 2010 10:08:19 GMT</pubDate></item><item><title><![CDATA[Reply to while-Schleife wird nur einmal &amp;quot;geöffnet&amp;quot; [gelöst] on Wed, 29 Dec 2010 10:17:37 GMT]]></title><description><![CDATA[<p>ianzahl = 0</p>
<p>upps, da hab ich was übersehen, danke.</p>
<p>i ist garnicht deklariert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1999907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1999907</guid><dc:creator><![CDATA[Tal Ker]]></dc:creator><pubDate>Wed, 29 Dec 2010 10:17:37 GMT</pubDate></item><item><title><![CDATA[Reply to while-Schleife wird nur einmal &amp;quot;geöffnet&amp;quot; [gelöst] on Wed, 29 Dec 2010 10:18:58 GMT]]></title><description><![CDATA[<p>daran hats gelegen.</p>
<p>hab einfach</p>
<pre><code class="language-cpp">&amp;&amp; i &lt; 9
</code></pre>
<p>gelöscht</p>
<p>vielen Dank nochmals<br />
und guten Rutsch</p>
<p>gruß<br />
Tal Ker</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1999909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1999909</guid><dc:creator><![CDATA[Tal Ker]]></dc:creator><pubDate>Wed, 29 Dec 2010 10:18:58 GMT</pubDate></item></channel></rss>