<?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[Iterationsszähler an fixer Stelle in Konsole hochzählen]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>wie kann ich eine Iterationszahl in der Konsole so ausgeben, das diese nicht fortlaufend untereinander ausgegeben wird, sondern die Zahl an der gleichen Stelle hochzählt?</p>
<p>Danke schon mal für Eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/338866/iterationsszähler-an-fixer-stelle-in-konsole-hochzählen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 03:17:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/338866.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Jul 2016 21:23:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:23:09 GMT]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>wie kann ich eine Iterationszahl in der Konsole so ausgeben, das diese nicht fortlaufend untereinander ausgegeben wird, sondern die Zahl an der gleichen Stelle hochzählt?</p>
<p>Danke schon mal für Eure Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502588</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502588</guid><dc:creator><![CDATA[Sewing]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:39:41 GMT]]></title><description><![CDATA[<p>Windows:</p>
<pre><code>#include &lt;windows.h&gt;

void SetCursorPosition(int x, int y)
{
    COORD pos = {x, y};

    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2502589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502589</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:41:08 GMT]]></title><description><![CDATA[<p>Clear the screen.</p>
<pre><code class="language-cpp">void clear_screen(){
#ifndef _WIN32
std::system(&quot;clear&quot;);
#else
std::system(&quot;CLS&quot;);
#endif
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2502590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502590</guid><dc:creator><![CDATA[rewbfkjureh]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:45:54 GMT]]></title><description><![CDATA[<p>Danke. Ich möchte aber nur wirklich an dieser Stelle immer einiges neu ausgeben und anderes, was davor ausgegeben wurde belassen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502591</guid><dc:creator><![CDATA[Sewing]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:45:54 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:51:19 GMT]]></title><description><![CDATA[<p>Standard-C++, die einzige mir bekannte Möglichkeit:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;thread&gt;
#include &lt;chrono&gt;

void countdown(int n){
    for(int x; n--; ){
        std::cout &lt;&lt; n &lt;&lt; std::flush;
        std::this_thread::sleep_for(std::chrono::seconds(1));
        std::cout &lt;&lt; std::string(x = std::to_string(n).size(), '\b')
                  &lt;&lt; std::string(x, ' ')
                  &lt;&lt; std::string(x, '\b');
    }
}

int main(){
    countdown(15);
}
</code></pre>
<p>Ansonsten, für Windows, machs wie Belli gezeigt hat.<br />
Für Linux nutzt du entweder Escape-Sequenzen oder die Ncurses Bibliothek.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502592</guid><dc:creator><![CDATA[rewbfkjureh]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:51:19 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 21:55:00 GMT]]></title><description><![CDATA[<p>rewbfkjureh schrieb:</p>
<blockquote>
<p>Clear the screen.</p>
<pre><code class="language-cpp">void clear_screen(){
#ifndef _WIN32
std::system(&quot;clear&quot;);
#else
std::system(&quot;CLS&quot;);
#endif
}
</code></pre>
</blockquote>
<p>Blödsinn!<br />
Windows:</p>
<pre><code>void ClearScreen()
{
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    COORD target = {0, 0};
    DWORD written;

    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &amp;csbi);
    FillConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE), ' ',
                                            csbi.dwSize.X * csbi.dwSize.Y,
                                            target, &amp;written);
    FillConsoleOutputAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7,
                                            csbi.dwSize.X * csbi.dwSize.Y,
                                            target, &amp;written);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2502593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502593</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 16 Jul 2016 21:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 22:01:31 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/22666">@Belli</a>,</p>
<p>Blödsinn ist das nicht.<br />
Funktioniert prima auf beiden Plattformen und ist für kleine Projekte/Anfänger super angebracht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502594</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502594</guid><dc:creator><![CDATA[rewbfkjureh]]></dc:creator><pubDate>Sat, 16 Jul 2016 22:01:31 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sat, 16 Jul 2016 22:21:15 GMT]]></title><description><![CDATA[<p>Naja, system - Aufrufe sind prinzipiell keine so gute Idee ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502596</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 16 Jul 2016 22:21:15 GMT</pubDate></item><item><title><![CDATA[Reply to Iterationsszähler an fixer Stelle in Konsole hochzählen on Sun, 17 Jul 2016 19:14:42 GMT]]></title><description><![CDATA[<p>Man muss nicht päpstlicher sein als der Papst.<br />
Für Prototyping ist system mehr als geeignet. Wenn es irgendwann Probleme macht, kann man den Befehl ja über die API nachprogrammieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502648</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Sun, 17 Jul 2016 19:14:42 GMT</pubDate></item></channel></rss>