<?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[c++ programm mir fehlt etwas]]></title><description><![CDATA[<p>Also das soll eine Art Wettspiel sein. Es generiert die Tore durch zufall 0-5.<br />
1 = gewinnen und 0 = verlieren.</p>
<p>zb: Du wettest das Österreich 1(gewinnt) und deutschland 0(verliert)</p>
<p>jz hat deutschland 4 zu 2 gegen österreich gewonnen, du hast die wette verloren.</p>
<p>jz zu meiner frage : wie kann ich ausgeben das 1 gewinnen ist und 0 verlieren ist .</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;time.h&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{ char antwort;<br />
int Tore,Tore2,Tipp,Tipp2;<br />
srand(int( time(0)));</p>
<p>{</p>
<p>cout&lt;&lt;&quot;* * * * WETTEN WIE DIE BRITEN * * * *&quot;;</p>
<p>cout&lt;&lt;&quot;\n\n 2.Mannschaft/ 0 = Verlieren, 1 = Gewinnen&quot;;</p>
<p>Tore=0+rand()%5;<br />
Tore2=0+rand()%5;</p>
<p>cout&lt;&lt;&quot;\n\nGeben Sie ihren Tipp ein fuer:&quot;;</p>
<p>cout&lt;&lt;&quot;\n\nAustria: &quot;;<br />
cin&gt;&gt;Tipp;</p>
<p>cout&lt;&lt;&quot;Deutschland:&quot;;<br />
cin&gt;&gt;Tipp2;</p>
<p>cout&lt;&lt;&quot;\n\nAustria &quot;&lt;&lt;Tore&lt;&lt;&quot; Deutschland &quot;&lt;&lt;Tore2&lt;&lt;&quot;\n&quot;;</p>
<p>cout &lt;&lt; &quot;\n\nProgramm wiederholen? (J/N) -&gt;&quot;;<br />
antwort=toupper(_getche());<br />
}<br />
while (antwort != 'N');<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/303849/c-programm-mir-fehlt-etwas</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 05:37:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/303849.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 May 2012 17:22:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 17:22:49 GMT]]></title><description><![CDATA[<p>Also das soll eine Art Wettspiel sein. Es generiert die Tore durch zufall 0-5.<br />
1 = gewinnen und 0 = verlieren.</p>
<p>zb: Du wettest das Österreich 1(gewinnt) und deutschland 0(verliert)</p>
<p>jz hat deutschland 4 zu 2 gegen österreich gewonnen, du hast die wette verloren.</p>
<p>jz zu meiner frage : wie kann ich ausgeben das 1 gewinnen ist und 0 verlieren ist .</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;time.h&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{ char antwort;<br />
int Tore,Tore2,Tipp,Tipp2;<br />
srand(int( time(0)));</p>
<p>{</p>
<p>cout&lt;&lt;&quot;* * * * WETTEN WIE DIE BRITEN * * * *&quot;;</p>
<p>cout&lt;&lt;&quot;\n\n 2.Mannschaft/ 0 = Verlieren, 1 = Gewinnen&quot;;</p>
<p>Tore=0+rand()%5;<br />
Tore2=0+rand()%5;</p>
<p>cout&lt;&lt;&quot;\n\nGeben Sie ihren Tipp ein fuer:&quot;;</p>
<p>cout&lt;&lt;&quot;\n\nAustria: &quot;;<br />
cin&gt;&gt;Tipp;</p>
<p>cout&lt;&lt;&quot;Deutschland:&quot;;<br />
cin&gt;&gt;Tipp2;</p>
<p>cout&lt;&lt;&quot;\n\nAustria &quot;&lt;&lt;Tore&lt;&lt;&quot; Deutschland &quot;&lt;&lt;Tore2&lt;&lt;&quot;\n&quot;;</p>
<p>cout &lt;&lt; &quot;\n\nProgramm wiederholen? (J/N) -&gt;&quot;;<br />
antwort=toupper(_getche());<br />
}<br />
while (antwort != 'N');<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214640</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 17:22:49 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:20:22 GMT]]></title><description><![CDATA[<p>Geht es nur darum, wer gewonnen hat? Oder auch um die genaue Anzahl an Toren? Und was ist mit unentschieden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214658</guid><dc:creator><![CDATA[GyroGearloose]]></dc:creator><pubDate>Wed, 23 May 2012 18:20:22 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:38:12 GMT]]></title><description><![CDATA[<p>GyroGearloose schrieb:</p>
<blockquote>
<p>Geht es nur darum, wer gewonnen hat? Oder auch um die genaue Anzahl an Toren? Und was ist mit unentschieden?</p>
</blockquote>
<p>das programm soll mir sagen das Die wette falsch war.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214663</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 18:38:12 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:43:22 GMT]]></title><description><![CDATA[<p>Ja, aber wann genau war die Wette falsch bzw. richtig?</p>
<p>Was soll passieren, wenn ich 2x eine 0 eingebe oder 2x eine 1?</p>
<p>Wenn man nur tippen soll, wer gewinnt, dann wäre es besser nur eine Eingabe zu machen, z. B. so:</p>
<pre><code>Wer gewinnt das Spiel?
[1] Austria
[2] Deutschland
Ihr Tipp:
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2214667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214667</guid><dc:creator><![CDATA[GyroGearloose]]></dc:creator><pubDate>Wed, 23 May 2012 18:43:22 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:58:04 GMT]]></title><description><![CDATA[<p>denk ich auch, warum zwei Tipps dabei?</p>
<p>Ansonsten einfach ne if-Verzweigung, dann weisst wer gewonnwn hat. Aber unentschhieden wird er komisch ausgeben, bzw. gar nicht</p>
<p>Und dann ist das ganze auch etwas faul, die Eingabe wird ja nicht überprüft, kann ja als Tipp auch 3321 eintragen, ohne Fehlermeldung.</p>
<p>Sag mal, was Du genau machen möchtest, dann kann man Die auch helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214672</guid><dc:creator><![CDATA[Lylantiel]]></dc:creator><pubDate>Wed, 23 May 2012 18:58:04 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:56:37 GMT]]></title><description><![CDATA[<p>GyroGearloose schrieb:</p>
<blockquote>
<p>Ja, aber wann genau war die Wette falsch bzw. richtig?</p>
<p>ich hab ja auf österreich 1 gewettet . aber beim spiel hat deutschland gewonnen.</p>
<p>Was soll passieren, wenn ich 2x eine 0 eingebe oder 2x eine 1?</p>
<p>eine fehler meldung, bei 2 x mal 0 drücken passiert nichst aber bei 2x 11 eine meldung, dass man nur zahlen von 0 -1 wählen kann.</p>
<p>Wenn man nur tippen soll, wer gewinnt, dann wäre es besser nur eine Eingabe zu machen, z. B. so:</p>
<pre><code>Wer gewinnt das Spiel?
[1] Austria
[2] Deutschland
Ihr Tipp:
</code></pre>
</blockquote>
<p>schaut nicht schlecht aus!:)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214674</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 18:56:37 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 18:56:43 GMT]]></title><description><![CDATA[<p>Wenn es nur ums Gewinnen geht, könnte das (anfängerfreundliche) Programm so aussehen:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
#include &lt;time.h&gt;

using namespace std;

const int MAX_TORE = 5;

const int AT = 1;
const int DE = 2;

int main()
{
	char wiederholen;
	int gewinner, tipp;
	int tore_de, tore_at;

	srand(int(time(0)));

	do
	{
		cout &lt;&lt; &quot;* * * * WETTEN WIE DIE BRITEN * * * *\n\n&quot;;

		tore_de = rand() % (MAX_TORE + 1);
		tore_at = rand() % (MAX_TORE + 1);

		cout &lt;&lt; &quot;Wer gewinnt das Spiel?\n&quot;;
		cout &lt;&lt; &quot;[&quot; &lt;&lt; AT &lt;&lt; &quot;] Austria\n&quot;;
		cout &lt;&lt; &quot;[&quot; &lt;&lt; DE &lt;&lt; &quot;] Deutschland\n&quot;;
		cout &lt;&lt; &quot;Ihr Tipp: &quot;;
		cin &gt;&gt; tipp;

		// Falscheingabe abfangen:
		while (tipp != AT &amp;&amp; tipp != DE)
		{
			cout &lt;&lt; &quot;Falsche Eingabe!\nIhr Tipp:&quot;;
			cin &gt;&gt; tipp;
		}

		cout &lt;&lt; &quot;\n\nAustria &quot;&lt;&lt; tore_at &lt;&lt; &quot; Deutschland &quot; &lt;&lt; tore_de &lt;&lt; &quot;\n&quot;;

		if (tore_at == tore_de)
			cout &lt;&lt; &quot;Das Spiel ging unentschieden aus! Ihr Tipp ist egal!\n&quot;;
		else
		{
			if (tore_at &gt; tore_de)
				gewinner = AT;
			else if (tore_at &lt; tore_de)
				gewinner = DE;

			if (tipp == gewinner)
				cout &lt;&lt; &quot;Sie haben richtig getippt!\n&quot;;
			else
				cout &lt;&lt; &quot;Sie haben falsch getippt!\n&quot;;
		}

		cout &lt;&lt; &quot;\n\nProgramm wiederholen? (J/N) -&gt; &quot;;
		cin &gt;&gt; wiederholen;
	}
	while (toupper(wiederholen) != 'N');
}
</code></pre>
<p>Da kannst du z. B. noch zur Übung eine dritte Antwortmöglichkeit &quot;[3] Unentschieden&quot; einbauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214675</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214675</guid><dc:creator><![CDATA[GyroGearloose]]></dc:creator><pubDate>Wed, 23 May 2012 18:56:43 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 19:10:06 GMT]]></title><description><![CDATA[<p>Danke ! Für die Hilfe ! Danke !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214681</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 19:10:06 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 19:26:50 GMT]]></title><description><![CDATA[<p>ich hab das programm ein bischen umgeschrieben , weil ich manche sachen nicht kenne. Aber es funktioniert trots dem . ich habe AT und DE als int variable genommen und hab AT auf 1 gesetzt und DE 2 gesetzt. würde es trotzdem funktionieren?</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;time.h&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
char wiederholen;<br />
int gewinner, tipp,AT,DE;<br />
int tore_de, tore_at;</p>
<p>srand(int(time(0)));</p>
<p>AT = 1;<br />
DE = 2;</p>
<p>do<br />
{<br />
cout &lt;&lt; &quot;* * * * WETTEN WIE DIE BRITEN * * * *\n\n&quot;;</p>
<p>tore_de =1+rand()%5;<br />
tore_at =1+rand()%5;</p>
<p>cout &lt;&lt; &quot;Wer gewinnt das Spiel?\n&quot;;<br />
cout &lt;&lt; &quot;[&quot; &lt;&lt; AT &lt;&lt; &quot;] Austria\n&quot;;<br />
cout &lt;&lt; &quot;[&quot; &lt;&lt; DE &lt;&lt; &quot;] Deutschland\n&quot;;<br />
cout &lt;&lt; &quot;Ihr Tipp: &quot;;<br />
cin &gt;&gt; tipp;</p>
<p>// Falscheingabe abfangen:<br />
while (tipp != AT &amp;&amp; tipp != DE)<br />
{<br />
cout &lt;&lt; &quot;Falsche Eingabe!\nIhr Tipp:&quot;;<br />
cin &gt;&gt; tipp;<br />
}</p>
<p>cout &lt;&lt; &quot;\n\nAustria &quot;&lt;&lt; tore_at &lt;&lt; &quot; Deutschland &quot; &lt;&lt; tore_de &lt;&lt; &quot;\n&quot;;</p>
<p>if (tore_at == tore_de)<br />
cout &lt;&lt; &quot;Das Spiel ging unentschieden aus! Ihr Tipp ist egal!\n&quot;;<br />
else<br />
{<br />
if (tore_at &gt; tore_de)<br />
gewinner = AT;<br />
else if (tore_at &lt; tore_de)<br />
gewinner = DE;</p>
<p>if (tipp == gewinner)<br />
cout &lt;&lt; &quot;Sie haben richtig getippt!\n&quot;;<br />
else<br />
cout &lt;&lt; &quot;Sie haben falsch getippt!\n&quot;;<br />
}</p>
<p>cout &lt;&lt; &quot;\n\nProgramm wiederholen? (J/N) -&gt; &quot;;<br />
cin &gt;&gt; wiederholen;<br />
}<br />
while (toupper(wiederholen) != 'N');<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214684</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 19:26:50 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 19:28:20 GMT]]></title><description><![CDATA[<p>mein deutsch ist ne katastophe! ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214685</guid><dc:creator><![CDATA[kevincam]]></dc:creator><pubDate>Wed, 23 May 2012 19:28:20 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 19:32:35 GMT]]></title><description><![CDATA[<p>Is eigentlich das Gleiche. Nur dein AT und DE ist eben nicht konstant und nicht global. Wenn Du wirklich neu in der Programmierung bist, kannste sowas ja mal nachlesen.</p>
<p>Funktionieren wird das!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214687</guid><dc:creator><![CDATA[Lylantiel]]></dc:creator><pubDate>Wed, 23 May 2012 19:32:35 GMT</pubDate></item><item><title><![CDATA[Reply to c++ programm mir fehlt etwas on Wed, 23 May 2012 19:40:58 GMT]]></title><description><![CDATA[<p>Das macht in dem Fall keinen funktionalen Unterschied. Das const vor den Variablendeklarationen bedeutet, dass die Variablen DE und AT nicht (ohne weiteres) änderbar sein sollen -- sie sind also konstant. Das ist guter Stil, weil man dadurch ausdrückt, dass sie nicht verändert werden und weil man eine Programmierfehler-Quelle reduziert.</p>
<p>Beachte auch, dass deine Torformel 1 + rand()%5 Zufallswerte aus dem Intervall [1, 5] zieht und nicht aus [0, 5]. Ist es das, was du willst?</p>
<p>edit: Etwas zu langsam.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2214689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2214689</guid><dc:creator><![CDATA[GyroGearloose]]></dc:creator><pubDate>Wed, 23 May 2012 19:40:58 GMT</pubDate></item></channel></rss>