<?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[goto problem]]></title><description><![CDATA[<p>Egal welche Zahl ich auch drücke der geht immer nach test: hin<br />
aber der soll da nur hin gehen wenn ich die 1 drücke was mache ich da falsch ?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int main ()
{
int zahl,test;
cout&lt;&lt;&quot;geben sie eine zahl ein:  \n&quot;;
cin&gt;&gt;zahl;

if (zahl==1)
        {
        goto test;
        }

test:
{
cout&lt;&lt;&quot;funktioniert\n&quot;;
}

system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/200240/goto-problem</link><generator>RSS for Node</generator><lastBuildDate>Sun, 04 Oct 2026 09:07:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/200240.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Dec 2007 13:57:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to goto problem on Wed, 12 Dec 2007 13:57:09 GMT]]></title><description><![CDATA[<p>Egal welche Zahl ich auch drücke der geht immer nach test: hin<br />
aber der soll da nur hin gehen wenn ich die 1 drücke was mache ich da falsch ?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int main ()
{
int zahl,test;
cout&lt;&lt;&quot;geben sie eine zahl ein:  \n&quot;;
cin&gt;&gt;zahl;

if (zahl==1)
        {
        goto test;
        }

test:
{
cout&lt;&lt;&quot;funktioniert\n&quot;;
}

system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1419367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1419367</guid><dc:creator><![CDATA[ABCD]]></dc:creator><pubDate>Wed, 12 Dec 2007 13:57:09 GMT</pubDate></item><item><title><![CDATA[Reply to goto problem on Wed, 12 Dec 2007 14:00:34 GMT]]></title><description><![CDATA[<p>Wo soll er denn sonst landen? Wenn zahl ungleich 1 ist, überspringt das Programm den Block mit dem goto - und landet in der nächsten Zeile/Anweisung dahinter (und das ist die, die auch als Ziel des goto dient).</p>
<p>PS: goto ist böse - wenn es geht, solltest du es vermeiden. (btw, was soll das eigentlich ergeben?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1419373</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1419373</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 12 Dec 2007 14:00:34 GMT</pubDate></item><item><title><![CDATA[Reply to goto problem on Wed, 12 Dec 2007 16:01:30 GMT]]></title><description><![CDATA[<p>Um Deinen kleinen Test tu berichtigen...</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
using namespace std; 

int main () 
{ 
int zahl,test; 
cout&lt;&lt;&quot;geben sie eine zahl ein:  \n&quot;; 
cin&gt;&gt;zahl; 

if (zahl==1) 
{ 
   goto test; 
} 
else
{
   goto end;
}
test: 
{ 
cout&lt;&lt;&quot;funktioniert\n&quot;; 
}

end:
system(&quot;PAUSE&quot;); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1419480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1419480</guid><dc:creator><![CDATA[templäd]]></dc:creator><pubDate>Wed, 12 Dec 2007 16:01:30 GMT</pubDate></item><item><title><![CDATA[Reply to goto problem on Wed, 12 Dec 2007 16:19:49 GMT]]></title><description><![CDATA[<p>Das wird ja immer gruseliger...</p>
<p>Wenn dann bitte gleich richtig (ohne goto):</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
using namespace std; 

void zahl_richtig()
    {
        cout &lt;&lt; &quot;funktioniert&quot; &lt;&lt; endl;
    }

int main () 
    { 
        int zahl;
            // 'int test' wird hier nirgens verwendet!
        cout &lt;&lt; &quot;geben sie eine zahl ein:  &quot; &lt;&lt; endl; 
        cin &gt;&gt; zahl; 

        if (zahl==1) zahl_richtig();

        // Wenn es schon unbedingt sein muss, dass die Konsole blockiert
        //  dann les dir mal das Konsolen-FAQ durch und vermeide 'System'
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1419495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1419495</guid><dc:creator><![CDATA[bwbg]]></dc:creator><pubDate>Wed, 12 Dec 2007 16:19:49 GMT</pubDate></item><item><title><![CDATA[Reply to goto problem on Wed, 12 Dec 2007 18:25:05 GMT]]></title><description><![CDATA[<p>Geht sogar noch ohne Methode:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main ()
{
  int zahl = 0;

  std::cout &lt;&lt; &quot;geben sie eine zahl ein:  \n&quot;;
  cin &gt;&gt; zahl;

  if(zahl == 1)
  {
    std::cout &lt;&lt; &quot;funktioniert\n&quot;;
  }

  //Programm anhalten... siehe Post von bwbg
}
</code></pre>
<p>:xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1419551</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1419551</guid><dc:creator><![CDATA[Spacemuck]]></dc:creator><pubDate>Wed, 12 Dec 2007 18:25:05 GMT</pubDate></item></channel></rss>