<?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[Brauche hilfe mit Wiederholungen!]]></title><description><![CDATA[<p>Hey, habe mal mit C++ angefangen, unzwar einen einfachen Taschenrechner.</p>
<p>Nur habe ich jetzt ein Problem, wenn man einmal eine Rechnung durchführt, endet alles^^</p>
<p>Hier mal der Source</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

char anweisung;
int zahl1;
int zahl2;
int ergebnis;
void Anweisungen()
{
cin &gt;&gt; zahl1;

cout &lt;&lt; &quot;Jetzt die 2 Zahl&quot; &lt;&lt; endl;

cin &gt;&gt; zahl2;

cout &lt;&lt; &quot;nun wehlen sie bitte aus ob sie +, -, * oder / wollen!&quot; &lt;&lt; endl;

cin &gt;&gt; anweisung;

if (anweisung == '+' )
{

ergebnis = zahl1+zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '-' )
{

ergebnis = zahl1-zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '*' )
{

ergebnis = zahl1*zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '/' )
{

ergebnis = zahl1/zahl2;
cout &lt;&lt; ergebnis;
}
}
void Zahlen()
{
 cout &lt;&lt; &quot;Willkommen, das ist ein Taschenrechner&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;Bitte rechnen.&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;-------------------------------------------------&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;1 / 2 / 3&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;4 / 5 / 6&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;7 / 8 / 9&quot; &lt;&lt; endl;
cout &lt;&lt;&quot;---/ 0 /--&quot; &lt;&lt; endl;
}
int main()
{

Zahlen();

Anweisungen();

return 0;
}
</code></pre>
<p>okay , habe es glaube jetzt selber herausgefunden ( durch rumprobieren)</p>
<p>Ich habe jetzt</p>
<p>return main();</p>
<p>Ist das so ok?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294190/brauche-hilfe-mit-wiederholungen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 23:26:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294190.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Oct 2011 14:20:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 14:29:09 GMT]]></title><description><![CDATA[<p>Hey, habe mal mit C++ angefangen, unzwar einen einfachen Taschenrechner.</p>
<p>Nur habe ich jetzt ein Problem, wenn man einmal eine Rechnung durchführt, endet alles^^</p>
<p>Hier mal der Source</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

char anweisung;
int zahl1;
int zahl2;
int ergebnis;
void Anweisungen()
{
cin &gt;&gt; zahl1;

cout &lt;&lt; &quot;Jetzt die 2 Zahl&quot; &lt;&lt; endl;

cin &gt;&gt; zahl2;

cout &lt;&lt; &quot;nun wehlen sie bitte aus ob sie +, -, * oder / wollen!&quot; &lt;&lt; endl;

cin &gt;&gt; anweisung;

if (anweisung == '+' )
{

ergebnis = zahl1+zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '-' )
{

ergebnis = zahl1-zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '*' )
{

ergebnis = zahl1*zahl2;
cout &lt;&lt; ergebnis;
}
if (anweisung == '/' )
{

ergebnis = zahl1/zahl2;
cout &lt;&lt; ergebnis;
}
}
void Zahlen()
{
 cout &lt;&lt; &quot;Willkommen, das ist ein Taschenrechner&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;Bitte rechnen.&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;-------------------------------------------------&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;1 / 2 / 3&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;4 / 5 / 6&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;7 / 8 / 9&quot; &lt;&lt; endl;
cout &lt;&lt;&quot;---/ 0 /--&quot; &lt;&lt; endl;
}
int main()
{

Zahlen();

Anweisungen();

return 0;
}
</code></pre>
<p>okay , habe es glaube jetzt selber herausgefunden ( durch rumprobieren)</p>
<p>Ich habe jetzt</p>
<p>return main();</p>
<p>Ist das so ok?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133348</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133348</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 14:29:09 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 14:39:09 GMT]]></title><description><![CDATA[<p>Huhu</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;limits&gt;
using namespace std;

void Zahlen()
{
    cout &lt;&lt; &quot;Willkommen, das ist ein Taschenrechner\n&quot;;
    cout &lt;&lt; &quot;Bitte rechnen.\n&quot;;
    cout &lt;&lt; &quot;-------------------------------------------------\n&quot;; // verwende kein endl, wo \n gemeint ist.
    cout &lt;&lt; &quot;1 / 2 / 3\n&quot;;
    cout &lt;&lt; &quot;4 / 5 / 6\n&quot;;
    cout &lt;&lt; &quot;7 / 8 / 9\n&quot;;
    cout &lt;&lt;&quot;--/ 0 /--\n&quot;;
}

void Anweisungen()
{
    char anweisung; // Halte deine Variablen so lokal wie möglich.
    double zahl1;   // Wenn du auch eine Division machen willst ist eine Fließkommazahl wohl geeigneter.
    double zahl2;
    double ergebnis;

    cin &gt;&gt; zahl1;   // Deine vielen Leerzeilen machen es nicht wirklich übersichtlicher.
    cout &lt;&lt; &quot;Jetzt die 2 Zahl\n&quot;;
    cin &gt;&gt; zahl2;
    cout &lt;&lt; &quot;nun wehlen sie bitte aus ob sie +, -, * oder / wollen!\n&quot;;
    cin &gt;&gt; anweisung;

    switch(anweisung) // Für so eine Art von Auswahl ist eine swicht-Anweisung wohl besser geeignet.
    {
        case '+':
            ergebnis = zahl1+zahl2;
            break;
        case '-':
            ergebnis = zahl1-zahl2;
            break;
        case '*':
            ergebnis = zahl1*zahl2;
            break;
        case '/':
            ergebnis = zahl1/zahl2;
            break;
    }
    cout &lt;&lt; ergebnis; // Du musst nicht in jedem Testfall das Ergebnis ausgeben, es reicht auch 1x am Ende.
}

int main()
{
    Zahlen();
    Anweisungen();

    cin.ignore(numeric_limits&lt;streamsize&gt;::max(),'\n'); // Die noch im Puffer stehenden Zeichen verwerfen, dass das Programm dann auch anhält.
    cin.get(); // Programm anhalten
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2133361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133361</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 19 Oct 2011 14:39:09 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 14:41:35 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>Ich habe jetzt</p>
<p>return main();</p>
<p>Ist das so ok?</p>
</blockquote>
<p>Was meinst du damit? In der main-Funktion darfst du return 0; weglassen, es wird dann automatisch gemacht. Ist aber nur bei der main-Funktion erlaubt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133362</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 19 Oct 2011 14:41:35 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 14:51:00 GMT]]></title><description><![CDATA[<p>einfach</p>
<p>return main();</p>
<p>so wird immer wieder am ende, main neu eingelegt^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133367</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 14:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 14:55:02 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>so wird immer wieder am ende, main neu eingelegt^^</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> nein, dann hast ja eine endlose Rekursion. Kennst du schon Schleifen (do while, while,for)? Damit kannst du Wiederholungen machen. <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="😉"
    /></p>
<p>edit: Erlaubt der Standard überhaupt, dass man die main-Methode im Programm aufruft?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133370</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 19 Oct 2011 14:55:02 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 16:45:29 GMT]]></title><description><![CDATA[<p>Nein, erlaubt er nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133406</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Wed, 19 Oct 2011 16:45:29 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:07:41 GMT]]></title><description><![CDATA[<p>Ja doch.. eben schon bei mir funktioniert es so...</p>
<p>der code den ich gepostet habe, und return main(); ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133417</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:07:41 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:09:35 GMT]]></title><description><![CDATA[<p>Das ist egal, der Stanard sagt trotzdem nein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133418</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:11:10 GMT]]></title><description><![CDATA[<p>mir egal?</p>
<p>Es funktioniert bei mir, also ist es mir egal was der Standard sagt...</p>
<p>.. bitte closen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133419</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133419</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:11:10 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:12:15 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>mir egal?</p>
<p>Es funktioniert bei mir, also ist es mir egal was der Standard sagt...</p>
<p>.. bitte closen</p>
</blockquote>
<p>In diesem Fall wuerde ich auf den Standard hoeren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133421</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133421</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:12:15 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:13:48 GMT]]></title><description><![CDATA[<p>seid ihr schwer von begriff?</p>
<p>Wieso? Wieso sollte ich?</p>
<p>So wie ich es gemacht habe funktioniert doch perfekt, wenn ihr mir nicht glaubt, nicht mein problem!</p>
<p>return main(); klapt wunderbar!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133424</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133424</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:13:48 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:19:20 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>return main(); klapt wunderbar!</p>
</blockquote>
<p>Ja, heute und auf Deinem Compiler.<br />
Aber beim nächsten Compilerupdate könnte sich das ändern. Oder der Lehrer hat einen Compiler, wo es nicht klappt und gibt Dir eine 6.</p>
<p>Sowas kann nicht passieren, wenn Du Code schreibst, der sich an den Standard hält. Der Standard ist halt das Buch, wo steht, was ein Compiler erlauben muß.</p>
<p>Vor allem ist hier der Trick mit return main() nicht nötig, weil Schleifen auch nicht viel komplizierter sind.<br />
Statt</p>
<pre><code class="language-cpp">int main()
{
   //tuwas
   return main();
}
</code></pre>
<p>benutzt man eine Schleife</p>
<pre><code class="language-cpp">int main()
{
   while(1+1==2)
   {
      //tuwas
   }
}
</code></pre>
<p>(oder while(true) oder for(;;))</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133426</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:19:20 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 17:19:50 GMT]]></title><description><![CDATA[<p>Das mit While verstehe ich noch nicht so ganz, und ich habe auch keinen Lehrer xD</p>
<p>Naja gut, aber für diesen billig Taschenrechner, mach ich das jetzt nicht anders, bei großen sachen, natürlich aber bei sowas nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133428</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133428</guid><dc:creator><![CDATA[Kinami37]]></dc:creator><pubDate>Wed, 19 Oct 2011 17:19:50 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 19:39:10 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>Naja gut, aber für diesen billig Taschenrechner, mach ich das jetzt nicht anders, bei großen sachen, natürlich aber bei sowas nicht.</p>
</blockquote>
<p><a href="http://www.wehype.com/fileadmin/user_upload/hypes/images/682_images_3.jpg" rel="nofollow">*facepalm*</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133494</guid><dc:creator><![CDATA[freaky]]></dc:creator><pubDate>Wed, 19 Oct 2011 19:39:10 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Wed, 19 Oct 2011 19:57:44 GMT]]></title><description><![CDATA[<p>Kinami37 schrieb:</p>
<blockquote>
<p>Naja gut, aber für diesen billig Taschenrechner, mach ich das jetzt nicht anders, bei großen sachen, natürlich aber bei sowas nicht.</p>
</blockquote>
<p>Programmierst du den Taschenrechner, um C++ zu lernen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133502</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133502</guid><dc:creator><![CDATA[Dobi]]></dc:creator><pubDate>Wed, 19 Oct 2011 19:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche hilfe mit Wiederholungen! on Thu, 20 Oct 2011 16:49:34 GMT]]></title><description><![CDATA[<p>Du bist zwar ganz lustig, aber ich würde dir trotzdem raten mit rumprobieren aufzuhören und lieber was lesen. Buchempfehlungen findest du in diesem Forum genug. Ich verstehe nur nicht, warum du um Hilfe bittest, sie dann aber nicht annimmst...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2133785</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2133785</guid><dc:creator><![CDATA[*Rewind*]]></dc:creator><pubDate>Thu, 20 Oct 2011 16:49:34 GMT</pubDate></item></channel></rss>