<?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[Zahlenrätselspeil]]></title><description><![CDATA[<p>Hi, Ich ahbe mal so ein kleines SPiel programmiert^^<br />
Es ist ein Zahlenratenspiel, jedoch ist die Korrekte Zahl immer 52!<br />
Aber ich will, dass es zwischen 1 und 100 ist!!</p>
<p>Hier der Code (Copyright by GerTiger):</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;

using namespace std;

int main(int argc, char *argv[])
{
    int zufall;
    int eingabe;
    srand(4);
    zufall = rand() % 1000 + 1;

    cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
    cin &gt;&gt; eingabe;

    while (eingabe != zufall) 
          {
                if (eingabe &gt; zufall) {
                            cout &lt;&lt; &quot;Kleiner\n&quot; &lt;&lt; endl;
                            cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
                            cin &gt;&gt; eingabe;
                            }
                if (eingabe &lt; zufall) {
                            cout &lt;&lt; &quot;Groesser\n&quot; &lt;&lt; endl;
                            cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
                            cin &gt;&gt; eingabe;
                            }
                }   

    if (eingabe = zufall) {
                cout &lt;&lt; &quot;Korrekt \a \n&quot; &lt;&lt; endl;
                }

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/184568/zahlenrätselspeil</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 18:31:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184568.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Jun 2007 17:00:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 17:00:49 GMT]]></title><description><![CDATA[<p>Hi, Ich ahbe mal so ein kleines SPiel programmiert^^<br />
Es ist ein Zahlenratenspiel, jedoch ist die Korrekte Zahl immer 52!<br />
Aber ich will, dass es zwischen 1 und 100 ist!!</p>
<p>Hier der Code (Copyright by GerTiger):</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;

using namespace std;

int main(int argc, char *argv[])
{
    int zufall;
    int eingabe;
    srand(4);
    zufall = rand() % 1000 + 1;

    cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
    cin &gt;&gt; eingabe;

    while (eingabe != zufall) 
          {
                if (eingabe &gt; zufall) {
                            cout &lt;&lt; &quot;Kleiner\n&quot; &lt;&lt; endl;
                            cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
                            cin &gt;&gt; eingabe;
                            }
                if (eingabe &lt; zufall) {
                            cout &lt;&lt; &quot;Groesser\n&quot; &lt;&lt; endl;
                            cout &lt;&lt; &quot;Geben Sie eine Zahle ein\n&quot; &lt;&lt; endl;
                            cin &gt;&gt; eingabe;
                            }
                }   

    if (eingabe = zufall) {
                cout &lt;&lt; &quot;Korrekt \a \n&quot; &lt;&lt; endl;
                }

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1307353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307353</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sat, 16 Jun 2007 17:00:49 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 17:23:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">srand(4);
</code></pre>
<p>Du initalisierst den Random-Seed immer mit 4.<br />
Dann ist es klar das immer die gleiche Zahl dabei rauskommt.<br />
Nimm lieber etwas was sich ständig ändert wie die Zeit <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>
<pre><code class="language-cpp">srand ( time(NULL) );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1307360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307360</guid><dc:creator><![CDATA[Mario Sandler]]></dc:creator><pubDate>Sat, 16 Jun 2007 17:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 17:23:43 GMT]]></title><description><![CDATA[<p>Problem hat sich gelöst!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307361</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sat, 16 Jun 2007 17:23:43 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 17:57:15 GMT]]></title><description><![CDATA[<p>Ich ahbe da doch noch eine Frage:<br />
Wie schaffe ich es, ein kleinen Menü zu batsel, dass so ausehen würde:</p>
<p>&lt;N&gt;eues Spiel<br />
&lt;B&gt;eenden</p>
<p>Bei neies Spiel sollte man dann zu dem Spiel kommen und bei Beenden dann aus den game! Und fuer neues Spiel müsste man N und fuer Beenden das B drücken!</p>
<p>plz help me!</p>
<p>mfg GerTiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307378</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sat, 16 Jun 2007 17:57:15 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 18:01:39 GMT]]></title><description><![CDATA[<p>do while schleife. damit das menü auch am anfang kommt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307380</guid><dc:creator><![CDATA[N.Registriert]]></dc:creator><pubDate>Sat, 16 Jun 2007 18:01:39 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 18:09:29 GMT]]></title><description><![CDATA[<p>Gib per cout</p>
<pre><code>&lt;N&gt;eues Spiel
&lt;B&gt;eenden
</code></pre>
<p>aus.</p>
<p>Lies eine Eingabe des Users ein,<br />
und mach ne Abfrage welche Taste er gedrückt hat.</p>
<p>Außerdem kann ich N.Registriert zustimmen,<br />
ne do-while Schleife würd dem code guttun.</p>
<p>Schau dir doch einfach mal an wies in diesem<br />
example gemacht wird (ist in C geschrieben<br />
und ist ne C++ Referenz <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 />
<a href="http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html" rel="nofollow">http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307382</guid><dc:creator><![CDATA[Mario Sandler]]></dc:creator><pubDate>Sat, 16 Jun 2007 18:09:29 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 18:21:58 GMT]]></title><description><![CDATA[<p>Danke für eure schnelle Antworten, leider weiss ich net, was die Seite mit meinem &quot;noch nicht erstellten Menü&quot; etwas zu tun hat. naja, ich probiere es mal selber raus, irgentwie klappt es dann schon noch <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>mfg GerTiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307389</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sat, 16 Jun 2007 18:21:58 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sat, 16 Jun 2007 18:33:39 GMT]]></title><description><![CDATA[<p>oO, ich glaube ich habe mich unterschätzt!<br />
Irgentiwe weiss ich nicht, mit welchen Code ich dies alles anstellen könnte...<br />
Könnt ihr mir vll. so ein paar tutorials (wenns welche gibt, dann halt selber einbisschen mir erkären^^) mir sie auf deutsch zu geben?<br />
Ich bin ja nur 11 und kann noch kein englisch^^</p>
<p>mfg GerTiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307398</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sat, 16 Jun 2007 18:33:39 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sun, 17 Jun 2007 04:26:16 GMT]]></title><description><![CDATA[<p>Also, ich habe mal ein Menü gebastelt, jedoch weiss jetzt nicht wie ich das mache, wenn ich n drücke, dass man dann auf ein neues Spiel kommt, wie geht das?</p>
<p>Hier das Menü:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;

using namespace std;

int main(int argc, char *argv[])
{

int eingabe;
cout&lt;&lt;&quot;..::WELCOME::..\n&quot;&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl;
cout&lt;&lt;&quot;Bitte schreiben Sie eine Zahl hin, di in Klammern steht!\n&quot;&lt;&lt;endl&lt;&lt;endl;
cout&lt;&lt;&quot;Neues Spiel  (1)\n&quot;&lt;&lt;endl;
cout&lt;&lt;&quot;Beenden      (2)\n&quot;&lt;&lt;endl;

cin&gt;&gt;eingabe;

switch(eingabe) {

case 1:
cout&lt;&lt;&quot;Ein neues Spiel startet in 5 Sekunden!\n&quot;&lt;&lt;endl;
break;

case 2:
cout&lt;&lt;&quot;Das Spiel wird beendet in 5 Sekunden  \n&quot;&lt;&lt;endl;
break;

}

system(&quot;PAUSE&quot;);
return 0;
}
</code></pre>
<p>Und hier mein Zahlenratenspiel:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;

using namespace std;

int main(int argc, char *argv[])
{
    int zufall;
    int eingabe;
    srand ( time(NULL) );
    zufall = rand() % 100 + 1;

    cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl;
    cin  &gt;&gt;eingabe;

    while (eingabe != zufall) 
          {
                if (eingabe &gt; zufall) {
                            cout &lt;&lt;&quot;Kleiner\n&quot;&lt;&lt;endl;
                            cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl;
                            cin  &gt;&gt;eingabe;
                            }
                if (eingabe &lt; zufall) {
                            cout &lt;&lt;&quot;Groesser\n&quot;&lt;&lt;endl;
                            cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl;
                            cin  &gt;&gt;eingabe;
                            }
                }   

    if (eingabe = zufall) {
                cout&lt;&lt;&quot;Korrekt \n&quot;&lt;&lt;endl;
                }

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>mfg GerTiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307516</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307516</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sun, 17 Jun 2007 04:26:16 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sun, 17 Jun 2007 06:35:28 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;cstdlib&gt; 
#include &lt;iostream&gt; 
#include &lt;stdlib.h&gt; 

using namespace std; 

void spiel();

int main(int argc, char *argv[]) 
{ 

int eingabe; 
cout&lt;&lt;&quot;..::WELCOME::..\n&quot;&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl; 
cout&lt;&lt;&quot;Bitte schreiben Sie eine Zahl hin, di in Klammern steht!\n&quot;&lt;&lt;endl&lt;&lt;endl; 
cout&lt;&lt;&quot;Neues Spiel  (1)\n&quot;&lt;&lt;endl; 
cout&lt;&lt;&quot;Beenden      (2)\n&quot;&lt;&lt;endl; 

cin&gt;&gt;eingabe; 

switch(eingabe) { 

case 1: 
	cout&lt;&lt;&quot;Ein neues Spiel startet in 5 Sekunden!\n&quot;&lt;&lt;endl; 
	spiel();
break; 

case 2: 
	cout&lt;&lt;&quot;Das Spiel wird beendet in 5 Sekunden  \n&quot;&lt;&lt;endl; 
break; 

} 

system(&quot;PAUSE&quot;); 
return 0; 
}

void spiel() {
    int zufall; 
    int eingabe; 
    srand ( time(NULL) ); 
    zufall = rand() % 100 + 1; 

    cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl; 
    cin  &gt;&gt;eingabe; 

    while (eingabe != zufall) 
          { 
                if (eingabe &gt; zufall) { 
                            cout &lt;&lt;&quot;Kleiner\n&quot;&lt;&lt;endl; 
                            cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl; 
                            cin  &gt;&gt;eingabe; 
                            } 
                if (eingabe &lt; zufall) { 
                            cout &lt;&lt;&quot;Groesser\n&quot;&lt;&lt;endl; 
                            cout &lt;&lt;&quot;Geben Sie eine Zahle ein\n&quot;&lt;&lt;endl; 
                            cin  &gt;&gt;eingabe; 
                            } 
                }   

    if (eingabe = zufall) { 
                cout&lt;&lt;&quot;Korrekt \n&quot;&lt;&lt;endl; 
                }

}
</code></pre>
<p>Vermutlich das einfachste, wenn du den restlichen Code nicht umstellen willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307525</guid><dc:creator><![CDATA[Dave* 0]]></dc:creator><pubDate>Sun, 17 Jun 2007 06:35:28 GMT</pubDate></item><item><title><![CDATA[Reply to Zahlenrätselspeil on Sun, 17 Jun 2007 07:46:29 GMT]]></title><description><![CDATA[<p>Echt danke!!</p>
<p>Es ist genau das was ich wollte!!!!</p>
<p>Thanx u!</p>
<p>mfg GerTiger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1307532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1307532</guid><dc:creator><![CDATA[GerTiger]]></dc:creator><pubDate>Sun, 17 Jun 2007 07:46:29 GMT</pubDate></item></channel></rss>