<?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[Bouncing Ball problem]]></title><description><![CDATA[<p>hallo,<br />
ich diesen code aus einem buch von ulla prinz abgetippt.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;cctype&gt;
using namespace std;
#define DELAY 10000000L
#define CLS (cout&lt;&lt;&quot;/033[2J&quot;)
#define LOCATE(z,s) (cout &lt;&lt; &quot;/033[&quot;&lt;&lt; z&lt;&lt;';'&lt;&lt;s&lt;&lt;'H')

void main()
{   
  int x=2,y=3,dx=1,speed=0;
  string floor(79,'-'), header = &quot;*****BALL******&quot;;
  CLS;
  LOCATE(1,25); cout &lt;&lt; header;
  LOCATE(25,1); cout &lt;&lt; floor;

  while(true)
  {
	  LOCATE(y,x); cout &lt;&lt; 'o'&lt;&lt;endl;
	  for( long wait = 0; wait &lt; DELAY;  ++wait)
	  ;
	  if (x==1 || x==79 ) dx = -dx;

	  if (y==24)
	  {
		  speed = -speed;
		  if (speed == 0) speed = -7;
      }
	  speed +=1;
	  LOCATE(y,x);  cout&lt;&lt; ' ';
	  y += speed; x+=dx;

  }
}
</code></pre>
<p>ich hab ka was der code machen soll. was beduetet</p>
<pre><code>#define CLS (cout&lt;&lt;&quot;/033[2J&quot;)
</code></pre>
<p>.<br />
es wird genau das gemacht was ich dachte, er gibt /033[2J aus was keinen sinn ergibt.</p>
<p>als compiler benutze ich VS2010<br />
hat jemand eine idee was das soll ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/291241/bouncing-ball-problem</link><generator>RSS for Node</generator><lastBuildDate>Mon, 17 Aug 2026 20:33:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/291241.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 Aug 2011 15:21:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 15:21:25 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich diesen code aus einem buch von ulla prinz abgetippt.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;cctype&gt;
using namespace std;
#define DELAY 10000000L
#define CLS (cout&lt;&lt;&quot;/033[2J&quot;)
#define LOCATE(z,s) (cout &lt;&lt; &quot;/033[&quot;&lt;&lt; z&lt;&lt;';'&lt;&lt;s&lt;&lt;'H')

void main()
{   
  int x=2,y=3,dx=1,speed=0;
  string floor(79,'-'), header = &quot;*****BALL******&quot;;
  CLS;
  LOCATE(1,25); cout &lt;&lt; header;
  LOCATE(25,1); cout &lt;&lt; floor;

  while(true)
  {
	  LOCATE(y,x); cout &lt;&lt; 'o'&lt;&lt;endl;
	  for( long wait = 0; wait &lt; DELAY;  ++wait)
	  ;
	  if (x==1 || x==79 ) dx = -dx;

	  if (y==24)
	  {
		  speed = -speed;
		  if (speed == 0) speed = -7;
      }
	  speed +=1;
	  LOCATE(y,x);  cout&lt;&lt; ' ';
	  y += speed; x+=dx;

  }
}
</code></pre>
<p>ich hab ka was der code machen soll. was beduetet</p>
<pre><code>#define CLS (cout&lt;&lt;&quot;/033[2J&quot;)
</code></pre>
<p>.<br />
es wird genau das gemacht was ich dachte, er gibt /033[2J aus was keinen sinn ergibt.</p>
<p>als compiler benutze ich VS2010<br />
hat jemand eine idee was das soll ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105718</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105718</guid><dc:creator><![CDATA[kantaki]]></dc:creator><pubDate>Sat, 13 Aug 2011 15:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 15:29:00 GMT]]></title><description><![CDATA[<p>Das ist eine Escapesequenz unter DOS zum Löschen des Bildschirms.<br />
Die wird unter Windows wahrscheinlich nicht mehr funktionieren.</p>
<p>siehe <a href="http://www.c-plusplus.net/forum/39323" rel="nofollow">http://www.c-plusplus.net/forum/39323</a> für genauere Info</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105720</guid><dc:creator><![CDATA[MGOS]]></dc:creator><pubDate>Sat, 13 Aug 2011 15:29:00 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 16:01:24 GMT]]></title><description><![CDATA[<p>kann man denn das buch&quot; a complete guide to programing in c++&quot; von prinz noch empfehlen ?</p>
<p>scheint mir etwas veraltet <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=":/"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105730</guid><dc:creator><![CDATA[kantaki]]></dc:creator><pubDate>Sat, 13 Aug 2011 16:01:24 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 16:04:32 GMT]]></title><description><![CDATA[<p>kantaki schrieb:</p>
<blockquote>
<p>kann man denn das buch&quot; a complete guide to programing in c++&quot; von prinz noch empfehlen ?<br />
scheint mir etwas veraltet <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=":/"
      alt="😕"
    /></p>
</blockquote>
<p>Auf jeden Fall ist obiger Code Müll.<br />
Mischung aus Pascal- und C-Stil, nur C++ ist nicht dabei.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105731</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sat, 13 Aug 2011 16:04:32 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 16:11:27 GMT]]></title><description><![CDATA[<p>primer ftw</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105733</guid><dc:creator><![CDATA[meeydoo]]></dc:creator><pubDate>Sat, 13 Aug 2011 16:11:27 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 18:31:39 GMT]]></title><description><![CDATA[<p>schon für</p>
<p>Ulla Prinz schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void main()
</code></pre>
</blockquote>
<p>sollte man die Buchauthorin ohrfeigen...<br />
void main() war zu keiner Zeit Standard-C++.</p>
<p>Zu den Escape-Sequenzen:<br />
Unter Unix/Linux funktionieren die einwandfrei und auch unter älteren Windows-Versionen.<br />
Die Ansi-Escape-Sequenzen werden erst ab Windows-NT nicht mehr unterstützt.</p>
<p>Das würde ich also weniger als Kritikpunkt betrachten.</p>
<p>Ansonsten hat volkard Recht:<br />
Massiger Gebrauch von Makros und Variablendeklarationen am Scope-Anfang weisen deutlich auf C hin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105768</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105768</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Sat, 13 Aug 2011 18:31:39 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 18:52:00 GMT]]></title><description><![CDATA[<p>DrakoXP schrieb:</p>
<blockquote>
<p>Zu den Escape-Sequenzen:<br />
Unter Unix/Linux funktionieren die einwandfrei und auch unter älteren Windows-Versionen.<br />
Die Ansi-Escape-Sequenzen werden erst ab Windows-NT nicht mehr unterstützt.</p>
<p>Das würde ich also weniger als Kritikpunkt betrachten.</p>
</blockquote>
<p>edit: Weg:&quot;<s>Nein, das nicht.</s>&quot; Hin:&quot;Nein, das ist nicht das Problem, da gebe ich Dir recht.&quot; Wir haben for(;;) als eigenes Idiom für Endlosschleifen. Aber CLS müßte wirklich eine Funktion sein. Und DELAY eine const. Die Zeitschleife hat keinen Körper und wird wegoptimiert. Wenigstens cout&lt;&lt;&quot;&quot;; machen. Alle Variablen am Anfang ist in C++ Anti-Stil. Selbst, wenn man CLS als Makro dulden würde, danbn aber bitte CLS(); statt CLS;. Kurzum, alles voll zum Kotzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105775</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sat, 13 Aug 2011 18:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 18:47:27 GMT]]></title><description><![CDATA[<p>Das mit em Kritikpunkt bezog sich einzig und allein auf die ANSI-Escape-Sequenzen.</p>
<p>Der Code an sich, da gebe ich dir völlig Recht, ist natürlich grauenhaft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105778</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Sat, 13 Aug 2011 18:47:27 GMT</pubDate></item><item><title><![CDATA[Reply to Bouncing Ball problem on Sat, 13 Aug 2011 19:23:13 GMT]]></title><description><![CDATA[<p>Wie immer ist system() schlecht doch da du scheinbar noch nichts selber geschrieben hast kannst du solange system(&quot;cls&quot;); nehmen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2105780</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2105780</guid><dc:creator><![CDATA[7xCore]]></dc:creator><pubDate>Sat, 13 Aug 2011 19:23:13 GMT</pubDate></item></channel></rss>