<?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[grundrechentrainer]]></title><description><![CDATA[<p>Hallo Leute <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="🙂"
    /><br />
ich schreibe grade an meinem Rechentrainer, komme aber nicht weiter <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 />
nachdem ich die erste lösung von einer aufgabe eingebe gibt der die nächste automatisch ein und jetzt weiß ich nicht was ich machen soll! und ich kenn mich damit nicht so gut aus... kann mir da jemand weiter helfen ?</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;iostream&gt;
//cleanscreen
#include &lt;conio.h&gt;
//Zufallszahlen
#include &lt;ctime&gt;
//Schriftfarbe
#include &lt;windows.h&gt;
#pragma argsused
using namespace std;

//---------------------------------------------------------------------------

  //Variablen für die Funktionen
  int i_rechenart, a_zahl, b_zahl, i_anzahl, int_i;

  //Variablen für die Zufallszahlen
  int zufallszahl, limit;

  //Variable dowhile Schleife
  char char_v;

// Umlaute

    // ö
   char oe=char(148);
   // ä
   char ae=char(132);

// Funktion 1

int rechenart()
{
  cout &lt;&lt;&quot;Welche Rechenart m&quot; &lt;&lt;oe&lt;&lt; &quot;chtest du benutzen?&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;[1]    Addieren    +&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[2]  Subtrahieren  -&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[3] Multiplizieren *&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[4]   Dividieren   :&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;                    &quot;&lt;&lt;endl;

  // Eingabe
  cin &gt;&gt; i_rechenart;

  return i_rechenart;
}

        // Funktion 2

        int Zahlenraum()
        {
        cout &lt;&lt;&quot;Jetzt kannst du den Zahlenraum aussuchen.&quot;&lt;&lt; endl;
        cout &lt;&lt;&quot;                    &quot;&lt;&lt;endl;

        cout &lt;&lt;&quot;Von: &quot;;
        cin &gt;&gt; a_zahl;

        cout &lt;&lt;&quot;bis &quot;;
        cin &gt;&gt; b_zahl;

        zufallszahl = (double)rand() / (b_zahl + 1) * limit + a_zahl;

        return a_zahl, b_zahl;
        }

                // Funktion 3

                int Aufgabenzahl()
                {
                cout &lt;&lt;&quot;und wie viel Aufgaben m&quot; &lt;&lt;oe&lt;&lt; &quot;chtest du rechnen?&quot;&lt;&lt; endl;

                cin &gt;&gt; i_anzahl;

                return i_anzahl;
                }

//Start des Hauptprogramms

int main()
{
do
{
//Schriftfarbe ändern
system(&quot;COLOR 0C&quot;);

  // Begrüßung
  cout &lt;&lt;&quot;================================&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;= Hallo!                       =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;= Willkommen im Rechentrainer! =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;================================&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;

  //Funktionen werden gestartet

  cout &lt;&lt;&quot;Bevor du anf&quot;&lt;&lt;ae&lt;&lt;&quot;ngst, musst du noch ein paar Fragen beantworten.&quot;&lt;&lt; endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;

  // erste Funktion wird aufgerufen
  rechenart();
  clrscr ();

  //zweite Funktion wird aufgerufen
  Zahlenraum();
  clrscr ();

  //dritte Funktion wird aufgerufen
  Aufgabenzahl();
  clrscr ();

    //Variablen für die Rechnung und For-Schleife

    float f_sum, f_prod, f_dif, f_quot, ergebnis;
    int z, x;

        //Rechnung mit For-Schleife

        for(z=1; z &lt;= i_anzahl; z++)
        {
        if (i_rechenart = 1)
        f_sum = zufallszahl + limit;
        //Ausgabe
        cout&lt;&lt; limit &lt;&lt; &quot;+&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; ;
        cin &gt;&gt; ergebnis;

        if (i_rechenart = 2)
        f_dif = zufallszahl - limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;-&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_dif  &lt;&lt;endl;

        if (i_rechenart = 3)
        f_prod = zufallszahl * limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;*&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_prod &lt;&lt;endl;

        if (i_rechenart = 4)
        f_quot = zufallszahl / limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;/&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_quot &lt;&lt;endl;

        }

  //Eingabe Variable
  cin &gt;&gt; char_v;

  //Pruefung der Bedingung
  if (char_v != 'J' &amp;&amp; char_v != 'j' &amp;&amp; char_v != 'N' &amp;&amp; char_v != 'n')

  //Ausgabe falls falsche Eingabe
  cout &lt;&lt; &quot;Falsche Eingabe!&quot; &lt;&lt; &quot;\n&quot;;
  }
  //Bedingung um zu Wiederholen
  while (char_v != 'J' &amp;&amp; char_v != 'j');

  //Ausgabe falls schleife beendet
  cout &lt;&lt; &quot;Bis zum nächsten mal! &quot; &lt;&lt; endl;

        system (&quot;PAUSE&quot;);
        return 0;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Dankeschön schon mal im vorraus <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/topic/260926/grundrechentrainer</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 20:24:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/260926.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Feb 2010 21:06:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to grundrechentrainer on Wed, 10 Feb 2010 21:12:41 GMT]]></title><description><![CDATA[<p>Hallo Leute <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="🙂"
    /><br />
ich schreibe grade an meinem Rechentrainer, komme aber nicht weiter <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 />
nachdem ich die erste lösung von einer aufgabe eingebe gibt der die nächste automatisch ein und jetzt weiß ich nicht was ich machen soll! und ich kenn mich damit nicht so gut aus... kann mir da jemand weiter helfen ?</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;iostream&gt;
//cleanscreen
#include &lt;conio.h&gt;
//Zufallszahlen
#include &lt;ctime&gt;
//Schriftfarbe
#include &lt;windows.h&gt;
#pragma argsused
using namespace std;

//---------------------------------------------------------------------------

  //Variablen für die Funktionen
  int i_rechenart, a_zahl, b_zahl, i_anzahl, int_i;

  //Variablen für die Zufallszahlen
  int zufallszahl, limit;

  //Variable dowhile Schleife
  char char_v;

// Umlaute

    // ö
   char oe=char(148);
   // ä
   char ae=char(132);

// Funktion 1

int rechenart()
{
  cout &lt;&lt;&quot;Welche Rechenart m&quot; &lt;&lt;oe&lt;&lt; &quot;chtest du benutzen?&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;[1]    Addieren    +&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[2]  Subtrahieren  -&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[3] Multiplizieren *&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;[4]   Dividieren   :&quot;&lt;&lt;endl;
  cout &lt;&lt;&quot;                    &quot;&lt;&lt;endl;

  // Eingabe
  cin &gt;&gt; i_rechenart;

  return i_rechenart;
}

        // Funktion 2

        int Zahlenraum()
        {
        cout &lt;&lt;&quot;Jetzt kannst du den Zahlenraum aussuchen.&quot;&lt;&lt; endl;
        cout &lt;&lt;&quot;                    &quot;&lt;&lt;endl;

        cout &lt;&lt;&quot;Von: &quot;;
        cin &gt;&gt; a_zahl;

        cout &lt;&lt;&quot;bis &quot;;
        cin &gt;&gt; b_zahl;

        zufallszahl = (double)rand() / (b_zahl + 1) * limit + a_zahl;

        return a_zahl, b_zahl;
        }

                // Funktion 3

                int Aufgabenzahl()
                {
                cout &lt;&lt;&quot;und wie viel Aufgaben m&quot; &lt;&lt;oe&lt;&lt; &quot;chtest du rechnen?&quot;&lt;&lt; endl;

                cin &gt;&gt; i_anzahl;

                return i_anzahl;
                }

//Start des Hauptprogramms

int main()
{
do
{
//Schriftfarbe ändern
system(&quot;COLOR 0C&quot;);

  // Begrüßung
  cout &lt;&lt;&quot;================================&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;= Hallo!                       =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;= Willkommen im Rechentrainer! =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;=                              =&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;================================&quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;

  //Funktionen werden gestartet

  cout &lt;&lt;&quot;Bevor du anf&quot;&lt;&lt;ae&lt;&lt;&quot;ngst, musst du noch ein paar Fragen beantworten.&quot;&lt;&lt; endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;
  cout &lt;&lt;&quot;                                &quot; &lt;&lt;endl;

  // erste Funktion wird aufgerufen
  rechenart();
  clrscr ();

  //zweite Funktion wird aufgerufen
  Zahlenraum();
  clrscr ();

  //dritte Funktion wird aufgerufen
  Aufgabenzahl();
  clrscr ();

    //Variablen für die Rechnung und For-Schleife

    float f_sum, f_prod, f_dif, f_quot, ergebnis;
    int z, x;

        //Rechnung mit For-Schleife

        for(z=1; z &lt;= i_anzahl; z++)
        {
        if (i_rechenart = 1)
        f_sum = zufallszahl + limit;
        //Ausgabe
        cout&lt;&lt; limit &lt;&lt; &quot;+&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; ;
        cin &gt;&gt; ergebnis;

        if (i_rechenart = 2)
        f_dif = zufallszahl - limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;-&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_dif  &lt;&lt;endl;

        if (i_rechenart = 3)
        f_prod = zufallszahl * limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;*&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_prod &lt;&lt;endl;

        if (i_rechenart = 4)
        f_quot = zufallszahl / limit;
        //Ausgabe
        cout&lt;&lt; limit&lt;&lt; &quot;/&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_quot &lt;&lt;endl;

        }

  //Eingabe Variable
  cin &gt;&gt; char_v;

  //Pruefung der Bedingung
  if (char_v != 'J' &amp;&amp; char_v != 'j' &amp;&amp; char_v != 'N' &amp;&amp; char_v != 'n')

  //Ausgabe falls falsche Eingabe
  cout &lt;&lt; &quot;Falsche Eingabe!&quot; &lt;&lt; &quot;\n&quot;;
  }
  //Bedingung um zu Wiederholen
  while (char_v != 'J' &amp;&amp; char_v != 'j');

  //Ausgabe falls schleife beendet
  cout &lt;&lt; &quot;Bis zum nächsten mal! &quot; &lt;&lt; endl;

        system (&quot;PAUSE&quot;);
        return 0;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Dankeschön schon mal im vorraus <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/1853882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853882</guid><dc:creator><![CDATA[tuli]]></dc:creator><pubDate>Wed, 10 Feb 2010 21:12:41 GMT</pubDate></item><item><title><![CDATA[Reply to grundrechentrainer on Wed, 10 Feb 2010 22:13:52 GMT]]></title><description><![CDATA[<p>Hallo tuli,</p>
<p>Willkommen im C++-Forum.</p>
<p>tausche die Zeilen 128 bis 154 gegen diese hier aus:</p>
<pre><code class="language-cpp">//Rechnung mit For-Schleife
        for(z=1; z &lt;= i_anzahl; z++)
        {
            if (i_rechenart == 1) // &lt;=== '=' ist Zuweisung und '==' Vergleich
            {
                f_sum = zufallszahl + limit;
                //Ausgabe
                cout&lt;&lt; limit &lt;&lt; &quot;+&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; ;
                cin &gt;&gt; ergebnis;
            } // &lt;=== if() geht bis zur geschlossenen Klammer

            if (i_rechenart == 2) 
            {
                f_dif = zufallszahl - limit;
                //Ausgabe
                cout&lt;&lt; limit&lt;&lt; &quot;-&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_dif  &lt;&lt;endl;
            }

            if (i_rechenart == 3)
            {
                f_prod = zufallszahl * limit;
                //Ausgabe
                cout&lt;&lt; limit&lt;&lt; &quot;*&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_prod &lt;&lt;endl;
            }

            if (i_rechenart == 4)
            {
                f_quot = zufallszahl / limit;
                //Ausgabe
                cout&lt;&lt; limit&lt;&lt; &quot;/&quot; &lt;&lt;zufallszahl&lt;&lt; &quot;=&quot; &lt;&lt;  f_quot &lt;&lt;endl;
            }
        }
</code></pre>
<p>.. dann geht's schon besser, aber noch nicht gut.<br />
Die Variable 'limit' wird nicht initialisiert und die Berechnung der Zufallszahl in Zeile 64 macht auch nicht das, was Du denkst, was es machen sollte.</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1853914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853914</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Wed, 10 Feb 2010 22:13:52 GMT</pubDate></item><item><title><![CDATA[Reply to grundrechentrainer on Thu, 11 Feb 2010 17:42:08 GMT]]></title><description><![CDATA[<p>Dankeschön <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="🙂"
    /><br />
Hab voll die doofen Fehler im Quelltext gemacht!</p>
<p>Aber jetzt läuft es endlich wie ich das haben wollte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854314</guid><dc:creator><![CDATA[tuli]]></dc:creator><pubDate>Thu, 11 Feb 2010 17:42:08 GMT</pubDate></item><item><title><![CDATA[Reply to grundrechentrainer on Fri, 12 Feb 2010 08:59:45 GMT]]></title><description><![CDATA[<p>Um solche Fehler zum vermeiden (auch bei Flüchtigkeitsfehlern) kann man sich überlegen, den konstanten Ausdruck immer nach links zu stellen. Da beschwert sich der Compiler schon bei der Zuweisung. Sieht manchmal aber etwas gewöhnungsbedürftig aus.</p>
<pre><code class="language-cpp">// kompiliert, ist aber wohl nicht das Gewünschte
if( a = 1 )

// kompiliert nicht
if( 1 = a )
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1854529</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854529</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Fri, 12 Feb 2010 08:59:45 GMT</pubDate></item></channel></rss>