<?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[Via Tastendruck nochmal Würfeln?]]></title><description><![CDATA[<p>Hallo liebes Forum,<br />
kurze Erklärung zu meinem Programm ich habe 2 Würfel die eine Zahl von<br />
1-6 zufällig generieren. Die Zwei zahlen werden verglichen und die Zahl<br />
die höher ist hat gewonnen. Nun möchte ich das wenn ich zum Beispiel Enter<br />
drücke dass neu gewürfelt wird und ein neuer Sieger ermittelt wird könnt ihr<br />
mir da weiter helfen ?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;conio&gt;
using namespace std;

class Wuerfel
{
private:
   int positionx,positiony;
public:  
   int augenzahl;
   Wuerfel(int, int);
   ~Wuerfel();
   void zeige(void);
   int wuerfeln(void);  
};
//--------------------------------------------------------------------
//--------------------------------------------------------------------
Wuerfel::Wuerfel(int x, int y)//Konstruktor
{ 
  positionx=x;
  positiony=y;
  wuerfeln();
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
Wuerfel::~Wuerfel()//Destruktor
{}

void Wuerfel::zeige(void){
  gotoxy(positionx, positiony); cout&lt;&lt;&quot;\xDA\xC4\xC4\xC4\xBF&quot;;
  gotoxy(positionx,positiony+1);cout&lt;&lt;&quot;\xB3 &quot; &lt;&lt; augenzahl &lt;&lt; &quot; \xB3&quot;;
  gotoxy(positionx,positiony+2);cout&lt;&lt;&quot;\xC0\xC4\xC4\xC4\xD9&quot;;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
int Wuerfel::wuerfeln()//Methode wuerfeln
{
augenzahl=rand()%6+1;
return augenzahl;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
int main()   
{ 
  gotoxy(30,1);cout &lt;&lt; &quot;W u e r f e l d e m o&quot;;
  gotoxy(30,2);cout &lt;&lt; &quot;=====================&quot;;
  gotoxy(10,10);cout&lt;&lt;&quot;Wuerfel Eins&quot;;
  gotoxy(50,10);cout&lt;&lt;&quot;Wuerfel Zwei&quot;;
  srand(time(0));

  Wuerfel w1(10,11);
  Wuerfel w2(50,11);

  w1.zeige();
  w2.zeige();

  if (w1.augenzahl==w2.augenzahl) {gotoxy(30,14);cout&lt;&lt;&quot;Unentschieden&quot;;}
  if (w2.augenzahl&gt;w1.augenzahl) {gotoxy(50,14);cout&lt;&lt;&quot;Gewonnen&quot;;}
  if (w1.augenzahl&gt;w2.augenzahl) {gotoxy(10,14);cout&lt;&lt;&quot;Gewonnen&quot;;}

  getchar();
  return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/338217/via-tastendruck-nochmal-würfeln</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 16:48:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/338217.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 31 May 2016 20:03:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Via Tastendruck nochmal Würfeln? on Tue, 31 May 2016 20:03:17 GMT]]></title><description><![CDATA[<p>Hallo liebes Forum,<br />
kurze Erklärung zu meinem Programm ich habe 2 Würfel die eine Zahl von<br />
1-6 zufällig generieren. Die Zwei zahlen werden verglichen und die Zahl<br />
die höher ist hat gewonnen. Nun möchte ich das wenn ich zum Beispiel Enter<br />
drücke dass neu gewürfelt wird und ein neuer Sieger ermittelt wird könnt ihr<br />
mir da weiter helfen ?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;conio&gt;
using namespace std;

class Wuerfel
{
private:
   int positionx,positiony;
public:  
   int augenzahl;
   Wuerfel(int, int);
   ~Wuerfel();
   void zeige(void);
   int wuerfeln(void);  
};
//--------------------------------------------------------------------
//--------------------------------------------------------------------
Wuerfel::Wuerfel(int x, int y)//Konstruktor
{ 
  positionx=x;
  positiony=y;
  wuerfeln();
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
Wuerfel::~Wuerfel()//Destruktor
{}

void Wuerfel::zeige(void){
  gotoxy(positionx, positiony); cout&lt;&lt;&quot;\xDA\xC4\xC4\xC4\xBF&quot;;
  gotoxy(positionx,positiony+1);cout&lt;&lt;&quot;\xB3 &quot; &lt;&lt; augenzahl &lt;&lt; &quot; \xB3&quot;;
  gotoxy(positionx,positiony+2);cout&lt;&lt;&quot;\xC0\xC4\xC4\xC4\xD9&quot;;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
int Wuerfel::wuerfeln()//Methode wuerfeln
{
augenzahl=rand()%6+1;
return augenzahl;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
int main()   
{ 
  gotoxy(30,1);cout &lt;&lt; &quot;W u e r f e l d e m o&quot;;
  gotoxy(30,2);cout &lt;&lt; &quot;=====================&quot;;
  gotoxy(10,10);cout&lt;&lt;&quot;Wuerfel Eins&quot;;
  gotoxy(50,10);cout&lt;&lt;&quot;Wuerfel Zwei&quot;;
  srand(time(0));

  Wuerfel w1(10,11);
  Wuerfel w2(50,11);

  w1.zeige();
  w2.zeige();

  if (w1.augenzahl==w2.augenzahl) {gotoxy(30,14);cout&lt;&lt;&quot;Unentschieden&quot;;}
  if (w2.augenzahl&gt;w1.augenzahl) {gotoxy(50,14);cout&lt;&lt;&quot;Gewonnen&quot;;}
  if (w1.augenzahl&gt;w2.augenzahl) {gotoxy(10,14);cout&lt;&lt;&quot;Gewonnen&quot;;}

  getchar();
  return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2497575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497575</guid><dc:creator><![CDATA[chiper97]]></dc:creator><pubDate>Tue, 31 May 2016 20:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to Via Tastendruck nochmal Würfeln? on Tue, 31 May 2016 20:14:14 GMT]]></title><description><![CDATA[<p>Du suchst <a href="http://en.cppreference.com/w/cpp/string/basic_string/getline" rel="nofollow">getline</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2497577</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497577</guid><dc:creator><![CDATA[LeereDose]]></dc:creator><pubDate>Tue, 31 May 2016 20:14:14 GMT</pubDate></item></channel></rss>