<?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[Finde Fehler im C++0 Programm nicht]]></title><description><![CDATA[<p>also, ich habe mich selbst an einem &quot;Schere-Stein-Papier&quot; spiel probiert, und bin auf einen Fehler gestoßen, welchen ich nun nach ca 2 Stunden selbst nicht lösen konnte, ich hoffe ihr könnt mir helfen.<br />
Der Fehler ist, dass das Programm den 2. switch-Befehl einfach überspringt...</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

short sa; //Spieler Auswahl
short ca; //PC auswahl

int main (void)

{ 
    top:
    cout &lt;&lt;&quot;Willkommen zu SgtAcestar's Schere-Stein-Papier-Spiel\n&quot;
         &lt;&lt;&quot;(Bitte wähle schreibe die Zahl deiner Auswahl und drücke Enter)\n&quot;
         &lt;&lt;&quot;\t1. Spiel starteb\n&quot;
         &lt;&lt;&quot;\t2. Tutorial\n&quot;
         &lt;&lt;&quot;\t3. Beenden\n&quot;
         &lt;&lt;&quot;\n\nSollte die das erste mal sein, dass du dieses Spiel spielst,\n&quot;
         &lt;&lt;&quot;so spiele bitte zuerst das Tutorial\n&quot;;
   char auswahl1;
   cin &gt;&gt; auswahl1;

   switch( auswahl1 ) {
        case '1':
            cin.sync();
            system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Ok, das Spiel startet nun\n&quot;;
            system (&quot;PAUSE&quot;);
 erneut:    system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Schere, Stein oder Papier?\n\n\n&quot;;

            ca = (rand()%3)+1;
            char auswahl2;
            cin &gt;&gt; auswahl2;
            switch( auswahl2 ){
            system (&quot;CLS&quot;);
                case 'stein':
                case 'Stein':
                sa == 1;
                case 'schere':
                case 'Schere':
                sa == 2;
                case 'papier':
                case 'Papier':
                sa == 3;

    if (sa == 1 &amp;&amp; ca == 1)
    {
         cin.sync();
         cout &lt;&lt;&quot;\n\nStein vs. Stein !\n\n\tUnentschieden!\n\n\n&quot;
              &lt;&lt;&quot;\ta.Erneut spielen | \tb.Hauptmenue&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 1 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Stein vs. Schere !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;
    }
    else if (sa == 1 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Stein vs. Papier !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 1)
    {
         cout &lt;&lt;&quot;Schere vs. Stein !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Schere vs. Schere !\n\n\tUnentschieden!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Schere vs. Papier !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 1)
    {
         cout &lt;&lt;&quot;Papier vs. Stein !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Papier vs. Schere !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Papier vs. Papier !\n\n\tUnentschieden!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;
    }
}

        case '2':
            system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Willkommen in Tutorial\n&quot;
                 &lt;&lt;&quot;Zum spielen des Spieles musst du nur\n&quot;
                 &lt;&lt;&quot;deine Auswahl als Wort schreiben\n&quot;
                 &lt;&lt;&quot;und dann mit 'ENTER' bestaetigen\n&quot;
                 &lt;&lt;&quot;(gross und klein schreibung spielt keine Rolle)&quot;;
            system(&quot;PAUSE&quot;);
            system(&quot;CLS&quot;);
            cin.sync();
            goto top;
         case '3':
                return 0;  
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/317856/finde-fehler-im-c-0-programm-nicht</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 21:39:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/317856.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 22 Jun 2013 18:25:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sat, 22 Jun 2013 18:25:09 GMT]]></title><description><![CDATA[<p>also, ich habe mich selbst an einem &quot;Schere-Stein-Papier&quot; spiel probiert, und bin auf einen Fehler gestoßen, welchen ich nun nach ca 2 Stunden selbst nicht lösen konnte, ich hoffe ihr könnt mir helfen.<br />
Der Fehler ist, dass das Programm den 2. switch-Befehl einfach überspringt...</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

short sa; //Spieler Auswahl
short ca; //PC auswahl

int main (void)

{ 
    top:
    cout &lt;&lt;&quot;Willkommen zu SgtAcestar's Schere-Stein-Papier-Spiel\n&quot;
         &lt;&lt;&quot;(Bitte wähle schreibe die Zahl deiner Auswahl und drücke Enter)\n&quot;
         &lt;&lt;&quot;\t1. Spiel starteb\n&quot;
         &lt;&lt;&quot;\t2. Tutorial\n&quot;
         &lt;&lt;&quot;\t3. Beenden\n&quot;
         &lt;&lt;&quot;\n\nSollte die das erste mal sein, dass du dieses Spiel spielst,\n&quot;
         &lt;&lt;&quot;so spiele bitte zuerst das Tutorial\n&quot;;
   char auswahl1;
   cin &gt;&gt; auswahl1;

   switch( auswahl1 ) {
        case '1':
            cin.sync();
            system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Ok, das Spiel startet nun\n&quot;;
            system (&quot;PAUSE&quot;);
 erneut:    system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Schere, Stein oder Papier?\n\n\n&quot;;

            ca = (rand()%3)+1;
            char auswahl2;
            cin &gt;&gt; auswahl2;
            switch( auswahl2 ){
            system (&quot;CLS&quot;);
                case 'stein':
                case 'Stein':
                sa == 1;
                case 'schere':
                case 'Schere':
                sa == 2;
                case 'papier':
                case 'Papier':
                sa == 3;

    if (sa == 1 &amp;&amp; ca == 1)
    {
         cin.sync();
         cout &lt;&lt;&quot;\n\nStein vs. Stein !\n\n\tUnentschieden!\n\n\n&quot;
              &lt;&lt;&quot;\ta.Erneut spielen | \tb.Hauptmenue&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 1 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Stein vs. Schere !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;
    }
    else if (sa == 1 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Stein vs. Papier !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 1)
    {
         cout &lt;&lt;&quot;Schere vs. Stein !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Schere vs. Schere !\n\n\tUnentschieden!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 2 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Schere vs. Papier !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 1)
    {
         cout &lt;&lt;&quot;Papier vs. Stein !\n\n\tDu gewinnst!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 2)
    {
         cout &lt;&lt;&quot;Papier vs. Schere !\n\n\tPC gewinnt!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;

    }
    else if (sa == 3 &amp;&amp; ca == 3)
    {
         cout &lt;&lt;&quot;Papier vs. Papier !\n\n\tUnentschieden!\n&quot;;
        system (&quot;PAUSE&quot;);
        system(&quot;CLS&quot;);
        goto top;
    }
}

        case '2':
            system (&quot;CLS&quot;);
            cout &lt;&lt;&quot;Willkommen in Tutorial\n&quot;
                 &lt;&lt;&quot;Zum spielen des Spieles musst du nur\n&quot;
                 &lt;&lt;&quot;deine Auswahl als Wort schreiben\n&quot;
                 &lt;&lt;&quot;und dann mit 'ENTER' bestaetigen\n&quot;
                 &lt;&lt;&quot;(gross und klein schreibung spielt keine Rolle)&quot;;
            system(&quot;PAUSE&quot;);
            system(&quot;CLS&quot;);
            cin.sync();
            goto top;
         case '3':
                return 0;  
}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2333387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333387</guid><dc:creator><![CDATA[BobBobsen]]></dc:creator><pubDate>Sat, 22 Jun 2013 18:25:09 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sat, 22 Jun 2013 18:29:51 GMT]]></title><description><![CDATA[<p>break</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333388</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 22 Jun 2013 18:29:51 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sat, 22 Jun 2013 18:45:57 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>break</p>
</blockquote>
<p>ich habe jetzt bei switch( auswahl2 ) break hinzugefügt, aber er überspringt die folgenden anweisungen immer noch...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333393</guid><dc:creator><![CDATA[BobBobsen]]></dc:creator><pubDate>Sat, 22 Jun 2013 18:45:57 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sat, 22 Jun 2013 21:48:43 GMT]]></title><description><![CDATA[<p>Jeder <strong>case</strong> muss abgebrochen werden, um den Durchgang weiterer zu unterbinden.<br />
In deinem ersten switch machst du das mit <strong>goto top</strong>, wie du es nun im 2ten geändert hast, hast du nicht gezeigt.</p>
<p>Lerne noch etwas weiter bzw. lies genauer, damit hättest du dir eine Menge Zeit gespart.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333437</guid><dc:creator><![CDATA[Youka]]></dc:creator><pubDate>Sat, 22 Jun 2013 21:48:43 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sun, 23 Jun 2013 07:51:50 GMT]]></title><description><![CDATA[<p>Nur weil man std::cin und std::cout verwendet, ist das noch lange kein C++ Programm. Schon mal was von Schleifen gehört? Wenn ja, dann verwende sie auch und vergiss goto. Wenn nicht, fange noch mal von vorn an zu lernen. Tipps für gute Bücher findest du hier im Forum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333465</guid><dc:creator><![CDATA[ohjeohje]]></dc:creator><pubDate>Sun, 23 Jun 2013 07:51:50 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sun, 23 Jun 2013 08:56:00 GMT]]></title><description><![CDATA[<p>- char auswahl2 nimmt ein einzelnes Zeichen auf, keinen String<br />
- 'Stein' ist kein String, sondern ein einzelnes Zeichen<br />
- switch/case kann keine Strings auswerten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333473</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333473</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 23 Jun 2013 08:56:00 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sun, 23 Jun 2013 15:11:51 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>hab auch mal gehört diese &quot;System()&quot; Befehle/Funktionen was auch immer sollen nicht sonderlich guter Stil sein.</p>
<p>mfg<br />
HarteWare</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333536</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Sun, 23 Jun 2013 15:11:51 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Sun, 23 Jun 2013 15:16:39 GMT]]></title><description><![CDATA[<p>HarteWare schrieb:</p>
<blockquote>
<p>hab auch mal gehört diese &quot;System()&quot; Befehle/Funktionen was auch immer sollen nicht sonderlich guter Stil sein.</p>
</blockquote>
<p>Hast du richtig gehört. Meide system(), es ist lahm und macht eine Subshell auf. Außerdem ist es nicht plattformunabhängig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2333539</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2333539</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sun, 23 Jun 2013 15:16:39 GMT</pubDate></item><item><title><![CDATA[Reply to Finde Fehler im C++0 Programm nicht on Tue, 25 Jun 2013 14:14:07 GMT]]></title><description><![CDATA[<p>Hier hab ich gerade noch etwas zu system gefunden: <a href="http://www.gidnetwork.com/b-61.html" rel="nofollow">http://www.gidnetwork.com/b-61.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2334239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2334239</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Tue, 25 Jun 2013 14:14:07 GMT</pubDate></item></channel></rss>