<?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[Stoppuhr brauche HILFE]]></title><description><![CDATA[<p>Servus zusammen,</p>
<p>ich bin am verzweifeln und bekomme mein Programm quasi nicht zum stoppen:-).</p>
<p>es geht um die folgende stoppuhr:</p>
<p>QC:</p>
<p>#include &lt;windows.h&gt;<br />
#include &lt;stdio.h&gt;</p>
<p>int main()<br />
{<br />
LARGE_INTEGER iFreq;<br />
LARGE_INTEGER iBegin1, stop1;<br />
double t1=0;</p>
<p>QueryPerformanceFrequency(&amp;iFreq);<br />
printf(&quot;zum Start Enter druecken&quot;);<br />
getchar();<br />
printf(&quot;Zeitmessung laeuft...\n&quot;);<br />
QueryPerformanceCounter(&amp;iBegin1);</p>
<p>while (t1&lt;=10000)<br />
{<br />
QueryPerformanceCounter(&amp;stop1);<br />
t1=double(stop1.QuadPart - iBegin1.QuadPart)/iFreq.QuadPart;<br />
Sleep(1);<br />
printf(&quot;Sek: %4.6f\r&quot;,t1);</p>
<p>}</p>
<p>getchar();<br />
return 0;<br />
}</p>
<p>//Komments zum Programm habe ich keine, braucht man egtl hierbei nicht. allerdings habe ich keine ahnung wie ich die uhr stoppe und wieder laufen lassen kann.</p>
<p>fuer hilfe waere ich extrem dankbar da ich es sehr dringend brauche.</p>
<p>Herzlichst</p>
<p>ElBarto</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/280840/stoppuhr-brauche-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 23:20:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/280840.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 22 Jan 2011 17:20:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 17:20:04 GMT]]></title><description><![CDATA[<p>Servus zusammen,</p>
<p>ich bin am verzweifeln und bekomme mein Programm quasi nicht zum stoppen:-).</p>
<p>es geht um die folgende stoppuhr:</p>
<p>QC:</p>
<p>#include &lt;windows.h&gt;<br />
#include &lt;stdio.h&gt;</p>
<p>int main()<br />
{<br />
LARGE_INTEGER iFreq;<br />
LARGE_INTEGER iBegin1, stop1;<br />
double t1=0;</p>
<p>QueryPerformanceFrequency(&amp;iFreq);<br />
printf(&quot;zum Start Enter druecken&quot;);<br />
getchar();<br />
printf(&quot;Zeitmessung laeuft...\n&quot;);<br />
QueryPerformanceCounter(&amp;iBegin1);</p>
<p>while (t1&lt;=10000)<br />
{<br />
QueryPerformanceCounter(&amp;stop1);<br />
t1=double(stop1.QuadPart - iBegin1.QuadPart)/iFreq.QuadPart;<br />
Sleep(1);<br />
printf(&quot;Sek: %4.6f\r&quot;,t1);</p>
<p>}</p>
<p>getchar();<br />
return 0;<br />
}</p>
<p>//Komments zum Programm habe ich keine, braucht man egtl hierbei nicht. allerdings habe ich keine ahnung wie ich die uhr stoppe und wieder laufen lassen kann.</p>
<p>fuer hilfe waere ich extrem dankbar da ich es sehr dringend brauche.</p>
<p>Herzlichst</p>
<p>ElBarto</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010257</guid><dc:creator><![CDATA[3lbart0]]></dc:creator><pubDate>Sat, 22 Jan 2011 17:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 17:31:56 GMT]]></title><description><![CDATA[<p>Wenn du gerne 10000 Sekunden warten willst, dann hört es halt gefühlt nicht auf <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>
]]></description><link>https://www.c-plusplus.net/forum/post/2010264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010264</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Sat, 22 Jan 2011 17:31:56 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 17:42:51 GMT]]></title><description><![CDATA[<p>ist ja no problemo, sie soll ja auch laufen. nur ab und an möchte ich auch die zeit mal gerne stoppen dies ist mein problem. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010274</guid><dc:creator><![CDATA[3lbart0]]></dc:creator><pubDate>Sat, 22 Jan 2011 17:42:51 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 17:51:22 GMT]]></title><description><![CDATA[<p>Versuchs mit GetAsyncKeyState: <a href="http://msdn.microsoft.com/en-us/library/ms646293" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms646293</a></p>
<p>Beispiel:</p>
<pre><code class="language-cpp">#include &lt;Windows.h&gt;
#include &lt;stdio.h&gt; 

int main() 
{
	LARGE_INTEGER iFreq; 
	LARGE_INTEGER iBegin1, stop1; 
	double t1=0; 

	QueryPerformanceFrequency(&amp;iFreq); 
	printf(&quot;zum Start Enter druecken&quot;); 
	getchar(); 
	printf(&quot;Zeitmessung laeuft...\n&quot;); 
	QueryPerformanceCounter(&amp;iBegin1); 

	do
	{ 
		QueryPerformanceCounter(&amp;stop1); 
		t1=double(stop1.QuadPart - iBegin1.QuadPart)/iFreq.QuadPart; 
		Sleep(1);
		printf(&quot;Sek: %4.6f\r&quot;,t1); 
	}while (t1&lt;=10 &amp;&amp; !GetAsyncKeyState(VK_SPACE));

	getchar(); 
	return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2010276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010276</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Sat, 22 Jan 2011 17:51:22 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 18:07:58 GMT]]></title><description><![CDATA[<p>muchas gracias, genau diese vk`s habe ich gesucht/gebraucht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010294</guid><dc:creator><![CDATA[3lbart0]]></dc:creator><pubDate>Sat, 22 Jan 2011 18:07:58 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 21:27:51 GMT]]></title><description><![CDATA[<p>ok haette es jetzt soweit fertig. meine letzte frage waere: Wie zentriert man einen text in cpp?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010384</guid><dc:creator><![CDATA[3lbart0]]></dc:creator><pubDate>Sat, 22 Jan 2011 21:27:51 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 21:40:35 GMT]]></title><description><![CDATA[<p>In cpp verwendet man kein printf <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="😉"
    /> wir haben dafür &lt;iostream&gt; mit std::cout. Zentrieren kannst du z.b. so:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;

int main()
{
	std::string text=&quot;Zentrierter Text&quot;;
	int max = 80;
	max=(max-text.size())/2;
	std::cout &lt;&lt; std::setw(max) &lt;&lt; &quot;&quot; &lt;&lt; text &lt;&lt; std::endl;
}
</code></pre>
<p>Edit: Wenn du es mit printf machen willst musst du auch einfach nur einen for-schleife machen die bis (max-text.size) / 2 geht und die entsprechende Anzahl Lehrzeichen ausgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010387</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Sat, 22 Jan 2011 21:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 21:48:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int max = 80;
max=(max-text.size())/2;
</code></pre>
<p>Ist klarer so:</p>
<pre><code class="language-cpp">int max=(80-text.size())/2;
</code></pre>
<p>oder</p>
<pre><code class="language-cpp">const int terminal_width = 80;
int max=(terminal_width-text.size())/2;
</code></pre>
<p>In printf geht das gleiche natürlich auch ohne for-Schleife.</p>
<pre><code class="language-cpp">char format[5];
sprintf(format, &quot;%s%i%s&quot;, &quot;%&quot;, 40-strlen(text)/2, &quot;s&quot;);
printf(format, text);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2010392</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010392</guid><dc:creator><![CDATA[Korrektor]]></dc:creator><pubDate>Sat, 22 Jan 2011 21:48:04 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 22:43:22 GMT]]></title><description><![CDATA[<p>so die 11:59 deathline habe ich fast bis aufs letzte ausgeschöpft. danke für eure hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010404</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010404</guid><dc:creator><![CDATA[3lbart0]]></dc:creator><pubDate>Sat, 22 Jan 2011 22:43:22 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 23:19:01 GMT]]></title><description><![CDATA[<p>auch wenn ich zu spät bin, so wäre</p>
<pre><code>#include &lt;time.h&gt;
double time_prog = 0.0;
double tstart = clock();

[...]

time_prog += clock()-tstart;
</code></pre>
<p>wohl auch eine einfache und gute Lösung gewesen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010416</guid><dc:creator><![CDATA[Zenker]]></dc:creator><pubDate>Sat, 22 Jan 2011 23:19:01 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 23:22:31 GMT]]></title><description><![CDATA[<p>Der Performancetimer ist wie der Name schon sagt, performanter. Deine Version ist Vergleichsweise langsam.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010417</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Sat, 22 Jan 2011 23:22:31 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 23:43:19 GMT]]></title><description><![CDATA[<p>Der Performancetimer kommt aus der windows.h und ist somit Windows-Spezifisch oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010424</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010424</guid><dc:creator><![CDATA[Zenker]]></dc:creator><pubDate>Sat, 22 Jan 2011 23:43:19 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 23:47:45 GMT]]></title><description><![CDATA[<p>Ja, aber schneller und genauer...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010427</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010427</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Sat, 22 Jan 2011 23:47:45 GMT</pubDate></item><item><title><![CDATA[Reply to Stoppuhr brauche HILFE on Sat, 22 Jan 2011 23:50:40 GMT]]></title><description><![CDATA[<p>Ok, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2010430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2010430</guid><dc:creator><![CDATA[Zenker]]></dc:creator><pubDate>Sat, 22 Jan 2011 23:50:40 GMT</pubDate></item></channel></rss>