<?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[Unerklärliche &amp;quot;Verhaltensstörung&amp;quot;]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe nicht direkt ein Problem, aber die Sache ließ mich ordentlich stutzen:</p>
<p><a href="http://www.zerowaitingtime.com/19055-download-1x1_Rechner.exe" rel="nofollow">http://www.zerowaitingtime.com/19055-download-1x1_Rechner.exe</a></p>
<p>Ein kleiner 1x1 Rechner, der die verschiedenen Reihen aufsagen kann. Die Eingabe ist gegen negative Zahlen und Zahlen &gt; 10 gesichert. Allerdings nimmt das Programm auch chars an, obwohl ich die Variable &quot;Reihe&quot; als int definiert habe. Wenn man einen character als Wert eingiebt, spuckt er die 2er Reihe aus (keine Ahnung warum gerade die) und beantwortet die Frage, ob man noch eine Reihe sehen möchte, von alleine und beendet sich. Aber seht am besten selbst.</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
    int Reihe;
    char Nochmal;
    int Again;

do
{
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Welche Reihe des kleinen 1x1 moechten Sie sehen? &quot; &lt;&lt; endl &lt;&lt; endl;
    cin &gt;&gt; Reihe;

    cout &lt;&lt; endl;

    if (Reihe &gt;= 10)
    {
              cerr &lt;&lt; &quot;Nur Reihen des KLEINEN 1x1!&quot; &lt;&lt; endl;
              system(&quot;PAUSE&quot;);	
              return 1;
    }
    else if (Reihe &lt; 0)
    {
              cerr &lt;&lt; &quot;Keine negativen Zahlen!&quot; &lt;&lt; endl;
              system(&quot;PAUSE&quot;);
              return 1;
    }

    cout &lt;&lt; &quot;Die &quot; &lt;&lt; Reihe &lt;&lt; &quot;er &quot; &lt;&lt; &quot;Reihe ist: &quot; &lt;&lt; endl &lt;&lt; endl;

    for (int i = 0; i &lt; 11; i++)
    {
        cout &lt;&lt; i*Reihe &lt;&lt; endl;
    }

   cout &lt;&lt; endl;   
   cout &lt;&lt; &quot;Moechten Sie noch eine Reihe sehen? j/n. &quot; &lt;&lt; endl &lt;&lt; endl;
   cin &gt;&gt; Nochmal;

   if ( Nochmal == 'j' ) Again = 1;

   else if ( Nochmal == 'n' )
        Again = 0;

   else
   {
       cout &lt;&lt; endl;
       cerr &lt;&lt; &quot;Falsche Eingabe, Programm wird beendet . . . &quot; &lt;&lt; endl;
       cout &lt;&lt; endl;
       system(&quot;PAUSE&quot;);	
       return 1;

   }
}
while (Again == 1);            
system(&quot;PAUSE&quot;);	   
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/178831/unerklärliche-quot-verhaltensstörung-quot</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 01:32:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/178831.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Apr 2007 16:18:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 16:18:17 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe nicht direkt ein Problem, aber die Sache ließ mich ordentlich stutzen:</p>
<p><a href="http://www.zerowaitingtime.com/19055-download-1x1_Rechner.exe" rel="nofollow">http://www.zerowaitingtime.com/19055-download-1x1_Rechner.exe</a></p>
<p>Ein kleiner 1x1 Rechner, der die verschiedenen Reihen aufsagen kann. Die Eingabe ist gegen negative Zahlen und Zahlen &gt; 10 gesichert. Allerdings nimmt das Programm auch chars an, obwohl ich die Variable &quot;Reihe&quot; als int definiert habe. Wenn man einen character als Wert eingiebt, spuckt er die 2er Reihe aus (keine Ahnung warum gerade die) und beantwortet die Frage, ob man noch eine Reihe sehen möchte, von alleine und beendet sich. Aber seht am besten selbst.</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
    int Reihe;
    char Nochmal;
    int Again;

do
{
    cout &lt;&lt; endl;
    cout &lt;&lt; &quot;Welche Reihe des kleinen 1x1 moechten Sie sehen? &quot; &lt;&lt; endl &lt;&lt; endl;
    cin &gt;&gt; Reihe;

    cout &lt;&lt; endl;

    if (Reihe &gt;= 10)
    {
              cerr &lt;&lt; &quot;Nur Reihen des KLEINEN 1x1!&quot; &lt;&lt; endl;
              system(&quot;PAUSE&quot;);	
              return 1;
    }
    else if (Reihe &lt; 0)
    {
              cerr &lt;&lt; &quot;Keine negativen Zahlen!&quot; &lt;&lt; endl;
              system(&quot;PAUSE&quot;);
              return 1;
    }

    cout &lt;&lt; &quot;Die &quot; &lt;&lt; Reihe &lt;&lt; &quot;er &quot; &lt;&lt; &quot;Reihe ist: &quot; &lt;&lt; endl &lt;&lt; endl;

    for (int i = 0; i &lt; 11; i++)
    {
        cout &lt;&lt; i*Reihe &lt;&lt; endl;
    }

   cout &lt;&lt; endl;   
   cout &lt;&lt; &quot;Moechten Sie noch eine Reihe sehen? j/n. &quot; &lt;&lt; endl &lt;&lt; endl;
   cin &gt;&gt; Nochmal;

   if ( Nochmal == 'j' ) Again = 1;

   else if ( Nochmal == 'n' )
        Again = 0;

   else
   {
       cout &lt;&lt; endl;
       cerr &lt;&lt; &quot;Falsche Eingabe, Programm wird beendet . . . &quot; &lt;&lt; endl;
       cout &lt;&lt; endl;
       system(&quot;PAUSE&quot;);	
       return 1;

   }
}
while (Again == 1);            
system(&quot;PAUSE&quot;);	   
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1266564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266564</guid><dc:creator><![CDATA[chris2k6]]></dc:creator><pubDate>Sun, 15 Apr 2007 16:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 16:22:30 GMT]]></title><description><![CDATA[<p>Tja ein Glück, dass dein PC nicht explodiert ist, das Verhalten ist nämlich nicht definiert, da du deinen Variablen keinen Wert zuweist - und selbst dann bin ich mir nicht sicher ob der operator&gt;&gt; trotzdem einen Wert zuweisen darf.<br />
Einfach mit einfach mit .fail()/.bad() schauen obs geklappt hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266567</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266567</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sun, 15 Apr 2007 16:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 16:48:37 GMT]]></title><description><![CDATA[<p><a href="http://www.research.att.com/~bs/bs_faq2.html#simple-program" rel="nofollow">http://www.research.att.com/~bs/bs_faq2.html#simple-program</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266590</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 15 Apr 2007 16:48:37 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 17:41:43 GMT]]></title><description><![CDATA[<p><a href="http://c-plusplus.net/forum/viewtopic-var-p-is-930673.html#930673" rel="nofollow">http://c-plusplus.net/forum/viewtopic-var-p-is-930673.html#930673</a> Besser <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266631</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266631</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 15 Apr 2007 17:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 19:21:52 GMT]]></title><description><![CDATA[<p>Das wundert mich jetzt, in meinem Skript &quot;Eine Einführung in C++&quot; von Karsten Urban hat der nie etwas derartiges getan.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266729</guid><dc:creator><![CDATA[chris2k6]]></dc:creator><pubDate>Sun, 15 Apr 2007 19:21:52 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 19:33:03 GMT]]></title><description><![CDATA[<p>chris2k6 schrieb:</p>
<blockquote>
<p>Das wundert mich jetzt, in meinem Skript &quot;Eine Einführung in C++&quot; von Karsten Urban hat der nie etwas derartiges getan.</p>
</blockquote>
<p>In der Lernphase wollte er es wahrscheinlich nicht unnötig kompliziert machen und hat auf Fehlerüberprüfungen verzichtet.</p>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1266737</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266737</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Sun, 15 Apr 2007 19:33:03 GMT</pubDate></item><item><title><![CDATA[Reply to Unerklärliche &amp;quot;Verhaltensstörung&amp;quot; on Sun, 15 Apr 2007 22:27:10 GMT]]></title><description><![CDATA[<p>boah super gut danke für die links!!! Dieser Code hat mir noch gefehlt! yeaha damit kann ich endlich in meinem Zahlenraten programm fehlerhafte eingaben abfangen und das von dir oben beschriebene Problem lösen!!! DANKE</p>
<pre><code>if(cin.fail())
{
    cin.clear();
    cin.ignore();
}
</code></pre>
<p>hab mir das bischen zurecht gemurkst und diese lösung klappt super</p>
<pre><code class="language-cpp">while (cin.fail())
        {

                cin.clear();
                cin.ignore();
                cout &lt;&lt; endl &lt;&lt; &quot;Falsche eingabe&quot; &lt;&lt; endl;
                cout &lt;&lt; &quot;Dein Tipp: &quot;;
                cin &gt;&gt; GerateneZahl;

        }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1266806</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1266806</guid><dc:creator><![CDATA[Sebbo]]></dc:creator><pubDate>Sun, 15 Apr 2007 22:27:10 GMT</pubDate></item></channel></rss>