<?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[C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin neu hier und hab direkt eine Frage.</p>
<p>Also, gibt es einen Befehl, der nur Zahlen beim Eintippen erlaubt.</p>
<p>Hier mal ein Beispiel:</p>
<p>Bitte 1. Zahl eingeben:<br />
Bitte 2. Zahl eingeben:</p>
<p>Und da sollen nur Zahlen erlaubt werden. Ich möchte jetzt keine super lange if-Abfrage schreiben. Gibt es da nichts was mir weiterhelfen könnte?</p>
<p>Vielen Dank im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/162796/c-hilfe-sollen-nur-zahlen-erlaunt-werdem-beim-eintippen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 20:00:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/162796.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Oct 2006 12:44:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 12:44:33 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich bin neu hier und hab direkt eine Frage.</p>
<p>Also, gibt es einen Befehl, der nur Zahlen beim Eintippen erlaubt.</p>
<p>Hier mal ein Beispiel:</p>
<p>Bitte 1. Zahl eingeben:<br />
Bitte 2. Zahl eingeben:</p>
<p>Und da sollen nur Zahlen erlaubt werden. Ich möchte jetzt keine super lange if-Abfrage schreiben. Gibt es da nichts was mir weiterhelfen könnte?</p>
<p>Vielen Dank im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159522</guid><dc:creator><![CDATA[JaBBa88]]></dc:creator><pubDate>Mon, 23 Oct 2006 12:44:33 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 12:48:18 GMT]]></title><description><![CDATA[<p>nimm IO-Streams und gib lass deine Werte über &gt;&gt; einlesen - wenn der Nutzer was falsches eingegeben hat, setzt der Stream ein Fehlerflag, das du abfragen kannst:</p>
<pre><code class="language-cpp">cout&lt;&lt;&quot;Bitte Zahl eingeben\n&quot;;
while(true)
{
  cin&gt;&gt;wert;
  if(!cin)
  {
    cout&lt;&lt;&quot;Sie sollen eine ZAHL eingeben&quot;;
    cin.clear();
    cin.ignore(100);
  }
  else break;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1159526</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159526</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 23 Oct 2006 12:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 13:07:29 GMT]]></title><description><![CDATA[<p>dieses ! vor cin heißt doch, wenn nichts in cin steh oder?</p>
<p>Also ich hab noch nicht ganz gecheckt, wo jetzt gesagt wird, dass keine Buchstaben erlaubt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159548</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159548</guid><dc:creator><![CDATA[JaBBa88]]></dc:creator><pubDate>Mon, 23 Oct 2006 13:07:29 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 13:11:45 GMT]]></title><description><![CDATA[<p>Du kannst es nicht verbieten, aber du kannst es danach überprüfen.</p>
<p>mit &quot;!cin&quot; überprüfst du ob der Stream noch ok ist, oder ob ein Fehler aufgetreten ist (z.B. falls man in int einliest aber Buchstaben eingegeben werden).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159552</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159552</guid><dc:creator><![CDATA[adfgadfg]]></dc:creator><pubDate>Mon, 23 Oct 2006 13:11:45 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 13:13:28 GMT]]></title><description><![CDATA[<p>btw mit do ... while gehts schöner</p>
<pre><code class="language-cpp">int in;
do {
    cin.clear();
    cin.ignore(cin.rdbuf()-&gt;in_avail());
    cin &gt;&gt; in;
} while(!cin);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1159555</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159555</guid><dc:creator><![CDATA[sdfgsdh]]></dc:creator><pubDate>Mon, 23 Oct 2006 13:13:28 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 17:27:50 GMT]]></title><description><![CDATA[<p>Mhm, wenn ich das alleine ohne irgendeinen anderen Code schreibe funktioniert das. Aber wenn ich das in meinen Code einfüge sagt er, dass es einen Fehler mit avail gibt.</p>
<p>Hab schon die Variable in geändert zu Zahl1 (das ist mein Varname) aber gibt trotzdem den Fehler aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159798</guid><dc:creator><![CDATA[JaBBa88]]></dc:creator><pubDate>Mon, 23 Oct 2006 17:27:50 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Hilfe. Sollen nur Zahlen erlaunt werdem beim Eintippen on Mon, 23 Oct 2006 17:37:07 GMT]]></title><description><![CDATA[<p>Code + Fehlermeldung, wir sind keine Hellseher. Bitte folgende Umleitung beachten: DENKEN -&gt; POSTEN!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159814</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159814</guid><dc:creator><![CDATA[sgertt]]></dc:creator><pubDate>Mon, 23 Oct 2006 17:37:07 GMT</pubDate></item></channel></rss>