<?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[Das nächste Problem :((]]></title><description><![CDATA[<p>Sollte ein Programm schreiben, dass zwei Zahlen einliest und den USer beliebige Grundberechnungen beliebig oft damit machen lässt.</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

int main()
{
    double a, b;
    int    Op;
    char c;

    do
    {
     cout &lt;&lt; &quot;Bitte geben Sie zwei Zahlen ein und druecken Sie jeweils &lt;Enter&gt;:\n\n&quot;;

     cout &lt;&lt; &quot;a = &quot;;
     cin  &gt;&gt; a;
     cout &lt;&lt; &quot;b = &quot;;
     cin  &gt;&gt; b;

    Keine_Reinit:

     if(c = 'G')
          {cout &lt;&lt; &quot;a = &quot; &lt;&lt; a &lt;&lt;&quot;\nb = &quot; &lt;&lt; b &lt;&lt; &quot;\n&quot;;     }; 

     cout &lt;&lt; &quot;\nEntscheiden Sie sich fuer eine der folgenden Operationen (per Ziffer)\n&quot;
          &lt;&lt; &quot;und druecken Sie &lt;Enter&gt;: \n\n&quot;
          &lt;&lt; &quot;a + b (1)\na - b (2)\nb - a (3)\na / b (4)\nb / a (5)\na * b (6)\n\n&quot;;

     cin  &gt;&gt; Op;
     cout &lt;&lt; &quot;\nIhr Ergebnis lautet: &quot;;

     switch(Op)
              {
              case 1:
                   cout &lt;&lt; a + b;
                   break;
              case 2:
                   cout &lt;&lt; a - b;
                   break;
              case 3:
                   cout &lt;&lt; b - a;
                   break;
              case 4:
                   if(!b)
                        {
                         cout &lt;&lt; &quot;Der Nenner ist Null. Keine Berechnung m\x94glich\n\n&quot;;
                         break;
                        }
                   cout &lt;&lt; a / b;
                   break;
              case 5:
                   if(!a)
                        {
                         cout &lt;&lt; &quot;Der Nenner ist Null. Keine Berechnung m\x94glich\n\n&quot;;
                         break;
                        }
                   cout &lt;&lt; b / a;
                   break;
              case 6:
                   cout &lt;&lt; a * b;
              }

              cout &lt;&lt; &quot;\n\n&quot;;
              cout &lt;&lt; &quot;Neue Zahlen: N und &lt;Enter&gt;\n&quot;
                   &lt;&lt; &quot;Gleiche Zahlen: G und &lt;Enter&gt;\n&quot;
                   &lt;&lt; &quot;Programmende: E und &lt;Enter&gt;\n&quot;;

              cin  &gt;&gt; c;
              cout &lt;&lt; &quot;\n\n&quot;;

              if(c = 'G') 
                   {goto Keine_Reinit;}

     } while(c != 'E');

     cout &lt;&lt; &quot;\n\nVielen Dank!\n\n&quot;;

     system(&quot;pause&quot;);

     return 0;
}
</code></pre>
<p>So, funktionert mal wieder nicht.<br />
Ich stell mich irgendwi ean, hab ich das GEfühl ^^<br />
Der kleine BAstard von Programm geht immer wieder zu Keine_Reinit, egal, was man eingibt. *nedversteh*<br />
Wo is der Fehler in meinem Code?</p>
<p>Danke im Voraus für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208064/das-nächste-problem</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 13:44:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208064.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 14 Mar 2008 11:49:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 11:49:47 GMT]]></title><description><![CDATA[<p>Sollte ein Programm schreiben, dass zwei Zahlen einliest und den USer beliebige Grundberechnungen beliebig oft damit machen lässt.</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

int main()
{
    double a, b;
    int    Op;
    char c;

    do
    {
     cout &lt;&lt; &quot;Bitte geben Sie zwei Zahlen ein und druecken Sie jeweils &lt;Enter&gt;:\n\n&quot;;

     cout &lt;&lt; &quot;a = &quot;;
     cin  &gt;&gt; a;
     cout &lt;&lt; &quot;b = &quot;;
     cin  &gt;&gt; b;

    Keine_Reinit:

     if(c = 'G')
          {cout &lt;&lt; &quot;a = &quot; &lt;&lt; a &lt;&lt;&quot;\nb = &quot; &lt;&lt; b &lt;&lt; &quot;\n&quot;;     }; 

     cout &lt;&lt; &quot;\nEntscheiden Sie sich fuer eine der folgenden Operationen (per Ziffer)\n&quot;
          &lt;&lt; &quot;und druecken Sie &lt;Enter&gt;: \n\n&quot;
          &lt;&lt; &quot;a + b (1)\na - b (2)\nb - a (3)\na / b (4)\nb / a (5)\na * b (6)\n\n&quot;;

     cin  &gt;&gt; Op;
     cout &lt;&lt; &quot;\nIhr Ergebnis lautet: &quot;;

     switch(Op)
              {
              case 1:
                   cout &lt;&lt; a + b;
                   break;
              case 2:
                   cout &lt;&lt; a - b;
                   break;
              case 3:
                   cout &lt;&lt; b - a;
                   break;
              case 4:
                   if(!b)
                        {
                         cout &lt;&lt; &quot;Der Nenner ist Null. Keine Berechnung m\x94glich\n\n&quot;;
                         break;
                        }
                   cout &lt;&lt; a / b;
                   break;
              case 5:
                   if(!a)
                        {
                         cout &lt;&lt; &quot;Der Nenner ist Null. Keine Berechnung m\x94glich\n\n&quot;;
                         break;
                        }
                   cout &lt;&lt; b / a;
                   break;
              case 6:
                   cout &lt;&lt; a * b;
              }

              cout &lt;&lt; &quot;\n\n&quot;;
              cout &lt;&lt; &quot;Neue Zahlen: N und &lt;Enter&gt;\n&quot;
                   &lt;&lt; &quot;Gleiche Zahlen: G und &lt;Enter&gt;\n&quot;
                   &lt;&lt; &quot;Programmende: E und &lt;Enter&gt;\n&quot;;

              cin  &gt;&gt; c;
              cout &lt;&lt; &quot;\n\n&quot;;

              if(c = 'G') 
                   {goto Keine_Reinit;}

     } while(c != 'E');

     cout &lt;&lt; &quot;\n\nVielen Dank!\n\n&quot;;

     system(&quot;pause&quot;);

     return 0;
}
</code></pre>
<p>So, funktionert mal wieder nicht.<br />
Ich stell mich irgendwi ean, hab ich das GEfühl ^^<br />
Der kleine BAstard von Programm geht immer wieder zu Keine_Reinit, egal, was man eingibt. *nedversteh*<br />
Wo is der Fehler in meinem Code?</p>
<p>Danke im Voraus für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474220</guid><dc:creator><![CDATA[Tonikum]]></dc:creator><pubDate>Fri, 14 Mar 2008 11:49:47 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 11:54:53 GMT]]></title><description><![CDATA[<p>Zeile 21 bzw. 73:<br />
Du verwendest den Zuweisungsoperator, nicht den Vergleichsoperator</p>
<p>if(c == 'G')...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474225</guid><dc:creator><![CDATA[sdfin]]></dc:creator><pubDate>Fri, 14 Mar 2008 11:54:53 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 11:56:38 GMT]]></title><description><![CDATA[<p>Und &quot;goto&quot; ist allgemein schlechter Programmierstil <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Wieso verwendest Du keine while-Schleife?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474227</guid><dc:creator><![CDATA[sdfin]]></dc:creator><pubDate>Fri, 14 Mar 2008 11:56:38 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 12:08:03 GMT]]></title><description><![CDATA[<p>Tonikum schrieb:</p>
<blockquote>
<pre><code>... while(c != 'E');
</code></pre>
</blockquote>
<p>macht er doch...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474233</guid><dc:creator><![CDATA[Machine]]></dc:creator><pubDate>Fri, 14 Mar 2008 12:08:03 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 15:43:13 GMT]]></title><description><![CDATA[<p>Hab mich doch erst vor ein paar Wochen in C++ eingelesen, hatte vorher noch nie programmiert, brauch'S aber für's Studium :((</p>
<p>naja, goto hab ich genommen, weil es ja nur in einem Fall dahin soll, eben falls der Anwender die gleichen Zahlen nochmal verwenden möchte.</p>
<p>Dachte, while wäre für den kurzen VErweis zu kompliziert. Ist das nicht so?</p>
<p>Wieso springt mir das Programm denn trotzdem zu dem Punkt, auch wenn ich was anderes eingebe, als G?</p>
<p>Danke im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474395</guid><dc:creator><![CDATA[Tonikum]]></dc:creator><pubDate>Fri, 14 Mar 2008 15:43:13 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Fri, 14 Mar 2008 15:45:08 GMT]]></title><description><![CDATA[<p>ach halt, etz versteh ich das mit dem Zuweisungsdingsbums *g*</p>
<p>Dankeschön! Funktioniert :oD</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474396</guid><dc:creator><![CDATA[Tonikum]]></dc:creator><pubDate>Fri, 14 Mar 2008 15:45:08 GMT</pubDate></item><item><title><![CDATA[Reply to Das nächste Problem :(( on Sat, 15 Mar 2008 08:41:00 GMT]]></title><description><![CDATA[<p>Tonikum schrieb:</p>
<blockquote>
<p>naja, goto hab ich genommen, weil es ja nur in einem Fall dahin soll, eben falls der Anwender die gleichen Zahlen nochmal verwenden möchte.</p>
<p>Dachte, while wäre für den kurzen VErweis zu kompliziert. Ist das nicht so?</p>
</blockquote>
<p>goto hat ganz extreme Nachteile und sollte nicht verwendet werden. Die Diskussionen um goto werde ich hier aber nicht weiter ausbreiten, dies solltest du mit ein wenig suchen selbst finden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474660</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Sat, 15 Mar 2008 08:41:00 GMT</pubDate></item></channel></rss>