<?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[if Abfragen Problem]]></title><description><![CDATA[<p>Hallo immer wenn ich am Anfang die 2 für Beenden drücke springt das Programm hier hin:</p>
<pre><code class="language-cpp">if (eingabe==1)
              {
                clrscr();
                cout&lt;&lt;&quot;Du bist am Fluss\n&quot;;
                cout&lt;&lt;&quot;(4) In Fluss gehen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }
</code></pre>
<p>Ich weiss einfach nicht was ich da falch mache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Kompletter Programm Code</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h &gt;
using namespace std;

int main()
{
int start,wohin,eingabe,fisch;

cout&lt;&lt;&quot;(1) Starten,  (2) Beenden&quot;;
cin&gt;&gt;start;

        if (start==2)
        {
           cout&lt;&lt;&quot;ende&quot;;
           system(&quot;PAUSE&quot;);
        }
do
{

        if (start==1)
        {
           clrscr();
           cout&lt;&lt;&quot;(1) Haus,  (2) Wald\n&quot;;
           cout&lt;&lt;&quot;Auswahl: &quot;;
           cin&gt;&gt;wohin;
        }

                if (wohin==1)
                {
                   clrscr();
                   cout&lt;&lt;&quot;haus&quot;
                   &lt;&lt;&quot;\n&quot;;
                   cout&lt;&lt;&quot;(3) Gegenstand nehmen\n&quot;;
                   cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                   cout&lt;&lt;&quot;Auswahl &quot;;
                   cin&gt;&gt;eingabe;
                }

                if (wohin==2)
                {
                   clrscr();
                   cout&lt;&lt;&quot;Wald\n&quot;
                   &lt;&lt;&quot;\n&quot;;
                   cout&lt;&lt;&quot;(1) Fluss\n&quot;;
                   cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                   cout&lt;&lt;&quot;Auswahl: &quot;;
                   cin&gt;&gt;eingabe;
                }

              if (eingabe==3)
              {
                clrscr();
                cout&lt;&lt;&quot;Gegenstang genommen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }

              if (eingabe==1)
              {
                clrscr();
                cout&lt;&lt;&quot;Du bist am Fluss\n&quot;;
                cout&lt;&lt;&quot;(4) In Fluss gehen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }

                if (eingabe==4)
                {
                  clrscr();
                  cout&lt;&lt;&quot;(2) Zurueck \n&quot;;
                  cout&lt;&lt;&quot;(6) Fisch fangen\n&quot;;
                  cout&lt;&lt;&quot;Auswahl: &quot;;
                  cin&gt;&gt;eingabe;
                }

}
while (eingabe==2);

system(&quot;PAUSE&quot;);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/216035/if-abfragen-problem</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 19:22:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/216035.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Jun 2008 12:20:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to if Abfragen Problem on Wed, 18 Jun 2008 12:20:54 GMT]]></title><description><![CDATA[<p>Hallo immer wenn ich am Anfang die 2 für Beenden drücke springt das Programm hier hin:</p>
<pre><code class="language-cpp">if (eingabe==1)
              {
                clrscr();
                cout&lt;&lt;&quot;Du bist am Fluss\n&quot;;
                cout&lt;&lt;&quot;(4) In Fluss gehen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }
</code></pre>
<p>Ich weiss einfach nicht was ich da falch mache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Kompletter Programm Code</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h &gt;
using namespace std;

int main()
{
int start,wohin,eingabe,fisch;

cout&lt;&lt;&quot;(1) Starten,  (2) Beenden&quot;;
cin&gt;&gt;start;

        if (start==2)
        {
           cout&lt;&lt;&quot;ende&quot;;
           system(&quot;PAUSE&quot;);
        }
do
{

        if (start==1)
        {
           clrscr();
           cout&lt;&lt;&quot;(1) Haus,  (2) Wald\n&quot;;
           cout&lt;&lt;&quot;Auswahl: &quot;;
           cin&gt;&gt;wohin;
        }

                if (wohin==1)
                {
                   clrscr();
                   cout&lt;&lt;&quot;haus&quot;
                   &lt;&lt;&quot;\n&quot;;
                   cout&lt;&lt;&quot;(3) Gegenstand nehmen\n&quot;;
                   cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                   cout&lt;&lt;&quot;Auswahl &quot;;
                   cin&gt;&gt;eingabe;
                }

                if (wohin==2)
                {
                   clrscr();
                   cout&lt;&lt;&quot;Wald\n&quot;
                   &lt;&lt;&quot;\n&quot;;
                   cout&lt;&lt;&quot;(1) Fluss\n&quot;;
                   cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                   cout&lt;&lt;&quot;Auswahl: &quot;;
                   cin&gt;&gt;eingabe;
                }

              if (eingabe==3)
              {
                clrscr();
                cout&lt;&lt;&quot;Gegenstang genommen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }

              if (eingabe==1)
              {
                clrscr();
                cout&lt;&lt;&quot;Du bist am Fluss\n&quot;;
                cout&lt;&lt;&quot;(4) In Fluss gehen\n&quot;;
                cout&lt;&lt;&quot;(2) Zurueck\n&quot;;
                cout&lt;&lt;&quot;Auswahl&quot;;
                cin&gt;&gt;eingabe;
              }

                if (eingabe==4)
                {
                  clrscr();
                  cout&lt;&lt;&quot;(2) Zurueck \n&quot;;
                  cout&lt;&lt;&quot;(6) Fisch fangen\n&quot;;
                  cout&lt;&lt;&quot;Auswahl: &quot;;
                  cin&gt;&gt;eingabe;
                }

}
while (eingabe==2);

system(&quot;PAUSE&quot;);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1531524</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1531524</guid><dc:creator><![CDATA[derDA]]></dc:creator><pubDate>Wed, 18 Jun 2008 12:20:54 GMT</pubDate></item><item><title><![CDATA[Reply to if Abfragen Problem on Wed, 18 Jun 2008 12:27:11 GMT]]></title><description><![CDATA[<p>derDA schrieb:</p>
<blockquote>
<p>Ich weiss einfach nicht was ich da falch mache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
</blockquote>
<p>1. Grauenhaft formartierter und strukturierter Code.<br />
2. Du landest automatisch in der Schleife, unabhängig von deiner Eingabe, da nachdem die if-Behandlung abgehandelt ist, das Programm an der Stelle weiterläuft.</p>
<pre><code class="language-cpp">...
    if (start==2)
    {
        cout&lt;&lt;&quot;ende&quot;;
        system(&quot;PAUSE&quot;);
    } // &lt;-- Am ende der if-Anweisung läuft das Programm weiter...
    do
    { //... und hier rein
        if (start==1) // wobei ich bezweifel das bei einer 2 diese if ausgeführt wird
        {
...
</code></pre>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1531530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1531530</guid><dc:creator><![CDATA[asc@ausgeloggt]]></dc:creator><pubDate>Wed, 18 Jun 2008 12:27:11 GMT</pubDate></item><item><title><![CDATA[Reply to if Abfragen Problem on Wed, 18 Jun 2008 12:27:49 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if (start==2)
{
    cout&lt;&lt;&quot;ende&quot;;
    system(&quot;PAUSE&quot;);
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1531532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1531532</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Wed, 18 Jun 2008 12:27:49 GMT</pubDate></item><item><title><![CDATA[Reply to if Abfragen Problem on Wed, 18 Jun 2008 12:51:07 GMT]]></title><description><![CDATA[<p>Ah okay danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1531560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1531560</guid><dc:creator><![CDATA[derDA]]></dc:creator><pubDate>Wed, 18 Jun 2008 12:51:07 GMT</pubDate></item><item><title><![CDATA[Reply to if Abfragen Problem on Wed, 18 Jun 2008 13:18:13 GMT]]></title><description><![CDATA[<p>und ich würde mal die Variablen sinnvoll initialisieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1531582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1531582</guid><dc:creator><![CDATA[Vorden]]></dc:creator><pubDate>Wed, 18 Jun 2008 13:18:13 GMT</pubDate></item></channel></rss>