<?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[Neulingsfrage zu einer webaufgabe]]></title><description><![CDATA[<p>Ich bin dabei C++ zu lernen und habe mich an den Übungsaufgaben auf <a href="http://www.cplusplus.com/forum/articles/12974/" rel="nofollow">http://www.cplusplus.com/forum/articles/12974/</a> versucht, ich hänge nun an der Aufgabe <strong>While( user == gullible )</strong>. In dieser soll man einen Code schreiben der den Benutzer Auffordert irgendeine andere Zahl als 5 einzugeben, dies habe ich auch geschafft. Anschliessend soll man den Code so umformulieren dass er nach 10 versuchen abbricht. Wenn ich meinen Code nun Kompiliere erscheint zwar keine Fehlermeldung aber das Programm bricht nicht nach 10 versuchen ab. Ich konnte den Fehler allerdings nicht finden <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="😞"
    /><br />
code:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

int main(void)
{
    int auswahl = 42;
    int i = 0;

    while ( i &lt;= 10 )
    {

    i = i + 1;

    while (auswahl != 5)
    {
        cout &lt;&lt; &quot;Please enter any number other than 5 \n&quot;;
        cin &gt;&gt; auswahl;
    }

    if ( auswahl == 5 )
    {
        cout &lt;&lt; &quot;Hey, you weren't supposed to enter 5!!!&quot; &lt;&lt; endl;
    }

    }
    if ( i &gt;= 10)
    {
        cout &lt;&lt; &quot;Wow, you're more patient than i am, you win. \n&quot;;
    }

    cin.sync();
    cin.get();
    return 0;
}
</code></pre>
<p>schonmal danke,<br />
v0xpection</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/320544/neulingsfrage-zu-einer-webaufgabe</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 02:40:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/320544.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Oct 2013 13:30:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Neulingsfrage zu einer webaufgabe on Wed, 02 Oct 2013 13:30:24 GMT]]></title><description><![CDATA[<p>Ich bin dabei C++ zu lernen und habe mich an den Übungsaufgaben auf <a href="http://www.cplusplus.com/forum/articles/12974/" rel="nofollow">http://www.cplusplus.com/forum/articles/12974/</a> versucht, ich hänge nun an der Aufgabe <strong>While( user == gullible )</strong>. In dieser soll man einen Code schreiben der den Benutzer Auffordert irgendeine andere Zahl als 5 einzugeben, dies habe ich auch geschafft. Anschliessend soll man den Code so umformulieren dass er nach 10 versuchen abbricht. Wenn ich meinen Code nun Kompiliere erscheint zwar keine Fehlermeldung aber das Programm bricht nicht nach 10 versuchen ab. Ich konnte den Fehler allerdings nicht finden <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="😞"
    /><br />
code:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

int main(void)
{
    int auswahl = 42;
    int i = 0;

    while ( i &lt;= 10 )
    {

    i = i + 1;

    while (auswahl != 5)
    {
        cout &lt;&lt; &quot;Please enter any number other than 5 \n&quot;;
        cin &gt;&gt; auswahl;
    }

    if ( auswahl == 5 )
    {
        cout &lt;&lt; &quot;Hey, you weren't supposed to enter 5!!!&quot; &lt;&lt; endl;
    }

    }
    if ( i &gt;= 10)
    {
        cout &lt;&lt; &quot;Wow, you're more patient than i am, you win. \n&quot;;
    }

    cin.sync();
    cin.get();
    return 0;
}
</code></pre>
<p>schonmal danke,<br />
v0xpection</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2357326</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2357326</guid><dc:creator><![CDATA[v0xpection]]></dc:creator><pubDate>Wed, 02 Oct 2013 13:30:24 GMT</pubDate></item><item><title><![CDATA[Reply to Neulingsfrage zu einer webaufgabe on Wed, 02 Oct 2013 13:34:04 GMT]]></title><description><![CDATA[<p>In Zeile 11 geht eine Klammer auf die ich nicht verstehe.<br />
Das while in Zeile 15 soll bestimmt ein if sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2357329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2357329</guid><dc:creator><![CDATA[nwp3]]></dc:creator><pubDate>Wed, 02 Oct 2013 13:34:04 GMT</pubDate></item><item><title><![CDATA[Reply to Neulingsfrage zu einer webaufgabe on Wed, 02 Oct 2013 13:36:25 GMT]]></title><description><![CDATA[<p>Die Klammer in Zeile 11 gehört zu der while schleife die verhindern soll dass das Programm öfters als 10 mal durchlaüft.<br />
Und das while in Zeile 15 soll auch ein while sein da das Programm ja immer wieder durchlaufen soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2357330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2357330</guid><dc:creator><![CDATA[v0xpection]]></dc:creator><pubDate>Wed, 02 Oct 2013 13:36:25 GMT</pubDate></item><item><title><![CDATA[Reply to Neulingsfrage zu einer webaufgabe on Wed, 02 Oct 2013 13:42:29 GMT]]></title><description><![CDATA[<p>v0xpection schrieb:</p>
<blockquote>
<p>Die Klammer in Zeile 11 gehört zu der while schleife die verhindern soll dass das Programm öfters als 10 mal durchlaüft.<br />
Und das while in Zeile 15 soll auch ein while sein da das Programm ja immer wieder durchlaufen soll.</p>
</blockquote>
<p>Ich nehme mal an, die 10 Durchläufe sollen sollen sich auf das &quot;Please enter any number other than 5&quot; beziehen, oder? Dann muss das natürlich auch dort geprüft werden und der Zähler ebenfalls dort erhöht werden. Oder einfacher: Die innere Schleife weglassen:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

int main(void)
{
  int auswahl = 42;
  int i = 0;

  while ( i &lt;= 10 &amp;&amp; auswahl != 5)
    {

      i = i + 1;

      cout &lt;&lt; &quot;Please enter any number other than 5 \n&quot;;
      cin &gt;&gt; auswahl;

      if ( auswahl == 5 )
        {
          cout &lt;&lt; &quot;Hey, you weren't supposed to enter 5!!!&quot; &lt;&lt; endl;
        }
    }
  if ( i &gt;= 10)
    {
      cout &lt;&lt; &quot;Wow, you're more patient than i am, you win. \n&quot;;
    }
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2357333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2357333</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 02 Oct 2013 13:42:29 GMT</pubDate></item><item><title><![CDATA[Reply to Neulingsfrage zu einer webaufgabe on Wed, 02 Oct 2013 13:47:56 GMT]]></title><description><![CDATA[<p>Danke, jetzt hat es funktioniert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2357335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2357335</guid><dc:creator><![CDATA[v0xpection]]></dc:creator><pubDate>Wed, 02 Oct 2013 13:47:56 GMT</pubDate></item></channel></rss>