<?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[Street !]]></title><description><![CDATA[<p>Hi !</p>
<p>Ich hab mal eine zufallstraße programmiert und wollte fragen, wie ich da jetzt ein<br />
Auto reinbekommen kann, welches ich steuern kann 1?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;windows.h&gt;
#include &quot;conioex.h&quot;
using namespace std;

int main()
{
     int richtung;
     int posx=30;
	 int posy=1;
	 int i=0;
	srand(time(NULL));

	for (;;)
	{

	richtung=(rand()%3)+1;

	if (richtung==1) //rechts
	{
	posx=posx+1;
	}
	if (richtung==2) //links
	{
	posx=posx-1;
	}
	if (richtung==3) //mitte
	{
	posx=posx;
	}

	Sleep(20);
	gotoxy(posx,posy);

	cout  &lt;&lt; char(219) &lt;&lt;&quot;             &quot; &lt;&lt; char(219);
	cout &lt;&lt; &quot; &quot;;
	posx--;
	gotoxy(posx,posy);
	cout &lt;&lt; &quot; &quot;;
	posx++;
	posy++;
	if(posx&gt;=50) //R
	{

	posx--;
	}
	if(posx==1) //L
	{

	posx++;
	}

	}

	return 0;

}
</code></pre>
<p>mfg clint</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/128075/street</link><generator>RSS for Node</generator><lastBuildDate>Tue, 25 Aug 2026 08:31:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/128075.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 30 Nov 2005 08:24:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 08:24:24 GMT]]></title><description><![CDATA[<p>Hi !</p>
<p>Ich hab mal eine zufallstraße programmiert und wollte fragen, wie ich da jetzt ein<br />
Auto reinbekommen kann, welches ich steuern kann 1?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;windows.h&gt;
#include &quot;conioex.h&quot;
using namespace std;

int main()
{
     int richtung;
     int posx=30;
	 int posy=1;
	 int i=0;
	srand(time(NULL));

	for (;;)
	{

	richtung=(rand()%3)+1;

	if (richtung==1) //rechts
	{
	posx=posx+1;
	}
	if (richtung==2) //links
	{
	posx=posx-1;
	}
	if (richtung==3) //mitte
	{
	posx=posx;
	}

	Sleep(20);
	gotoxy(posx,posy);

	cout  &lt;&lt; char(219) &lt;&lt;&quot;             &quot; &lt;&lt; char(219);
	cout &lt;&lt; &quot; &quot;;
	posx--;
	gotoxy(posx,posy);
	cout &lt;&lt; &quot; &quot;;
	posx++;
	posy++;
	if(posx&gt;=50) //R
	{

	posx--;
	}
	if(posx==1) //L
	{

	posx++;
	}

	}

	return 0;

}
</code></pre>
<p>mfg clint</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930327</guid><dc:creator><![CDATA[clint]]></dc:creator><pubDate>Wed, 30 Nov 2005 08:24:24 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 09:01:06 GMT]]></title><description><![CDATA[<p>wie beendest du eigenzlich die endlosschleife <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>ich find kein break</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930339</guid><dc:creator><![CDATA[golden_jubilee]]></dc:creator><pubDate>Wed, 30 Nov 2005 09:01:06 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 09:23:03 GMT]]></title><description><![CDATA[<p>mmhm, das sollte nachher kommen...</p>
<p>wenn autokoordinate gleich straßenkoordinate ! Das ist es vorbei !</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930349</guid><dc:creator><![CDATA[clint]]></dc:creator><pubDate>Wed, 30 Nov 2005 09:23:03 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 09:54:08 GMT]]></title><description><![CDATA[<p>ich würde anstelle der zufallsbestimmten Richtung auf Benutzereingaben reagieren (&quot;char inp=cin.get();switch(inp){...}&quot;).</p>
<p>PS: Falls du auf die Pfeiltasten reagieren oder &quot;nicht-blockierend&quot; einlesen willst, empfehle ich einen Blick in die Konsolen-FAQ.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930390</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Wed, 30 Nov 2005 09:54:08 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 10:29:48 GMT]]></title><description><![CDATA[<p>naja, aber dann kann man die Strecke aj immer vorraussehen !</p>
<p>Eventuell müsste ich das alle mochmal überarbeiten ! ...</p>
<p>danke</p>
<p>mfg clint</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930416</guid><dc:creator><![CDATA[clint]]></dc:creator><pubDate>Wed, 30 Nov 2005 10:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 10:41:34 GMT]]></title><description><![CDATA[<p>Ich würde es ja so machen, daß ich die aktuelle Richtung in regelmäßigen Abständen kontrolliere und den Wagen entsprechend bewege - dazwischen wird mit &quot;if(kbhit())...&quot; abgefragt, ob der Fahrer eine Taste gedrückt hat und die Richtung entsprechend angepasst:</p>
<pre><code>const time_t ftime=25;//Frame-Zeit, hier in ms
time_t t0=time();//am besten wäre eine Auflösung in ms
while(!crash)
{
  if(kbhit()
  {
    char ch=getch();
    if(ch==0) ch=getch();//Steuerzeichen = 0/xx
    update_richtung(ch);
  }
  if(time()-t0&gt;ftime)
  {
    update_position();
    zeichne();
    t0=time();
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/930423</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930423</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Wed, 30 Nov 2005 10:41:34 GMT</pubDate></item><item><title><![CDATA[Reply to Street ! on Wed, 30 Nov 2005 11:18:26 GMT]]></title><description><![CDATA[<p>ok !</p>
<p>Ich werds probieren ! Werden dem code posten ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930443</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930443</guid><dc:creator><![CDATA[clint]]></dc:creator><pubDate>Wed, 30 Nov 2005 11:18:26 GMT</pubDate></item></channel></rss>