<?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[C++ Rekursive Schleife Fehler]]></title><description><![CDATA[<p>Moin!</p>
<p>Ich schreibe nebenbei an meinem PC einige kleinere Programme (aus Hobbygründen).<br />
Bei dem unten angegebenen Code soll auf dem Bildschrim und in eine txt Datei eine generierte Teichenfolge angezeigt bzw geschriebene werden.</p>
<p>Bloß wird nach dem ersten Buchstabendurchlauf (nach dem &quot;Z&quot;) nur eine &quot;0&quot; anzeigt,satt &quot;00&quot;.</p>
<p>Wo liegt der Fehler in dem Code?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;cstring&gt;

using namespace std;

ofstream dat_aus;

string dateiname2=&quot;datei.txt&quot;;

int loop;
int loop2;
int a;
int b;
int c;
int d;
int e;
int f;
int g;

// &quot;\0&quot; im in der variable &quot;array&quot; soll als leeres &quot;Zeichen&quot; bzw einfach nur leer sein

string array[63] = {&quot;\0&quot;,&quot;0&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,
					&quot;9&quot;,&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;,&quot;f&quot;,&quot;g&quot;,&quot;h&quot;,&quot;i&quot;,
					&quot;j&quot;,&quot;k&quot;,&quot;l&quot;,&quot;m&quot;,&quot;n&quot;,&quot;o&quot;,&quot;p&quot;,&quot;q&quot;,&quot;r&quot;,&quot;s&quot;,
					&quot;t&quot;,&quot;u&quot;,&quot;v&quot;,&quot;w&quot;,&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,
					&quot;D&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;I&quot;,&quot;J&quot;,&quot;K&quot;,&quot;L&quot;,&quot;M&quot;,
					&quot;N&quot;,&quot;O&quot;,&quot;P&quot;,&quot;Q&quot;,&quot;R&quot;,&quot;S&quot;,&quot;T&quot;,&quot;U&quot;,&quot;V&quot;,&quot;W&quot;,
					&quot;X&quot;,&quot;Y&quot;,&quot;Z&quot;};

int func_generate() {

	dat_aus.open(dateiname2.c_str(), ios_base::out);

  	if(!dat_aus) {

     	cout &lt;&lt; &quot;Datei konnte nicht geoeffnet werden!&quot;;
     	cout &lt;&lt; endl;
     	return -1;

  	}

	else {

		for(loop2=0;loop2&lt;6;loop2++) {

			loop2=0;

			for(a=0;a&lt;63;a++) {

				// Hier wird nach dem &quot;Z&quot; nur eine &quot;0&quot; statt &quot;00&quot; angezeigt

				cout &lt;&lt; array[g]&lt;&lt; array[f]  &lt;&lt; array[e] &lt;&lt; array[d] &lt;&lt; array[c] &lt;&lt; array[b] &lt;&lt; array[a] &lt;&lt; endl;
				dat_aus &lt;&lt; array[g]&lt;&lt; array[f]  &lt;&lt; array[e] &lt;&lt; array[d] &lt;&lt; array[c] &lt;&lt; array[b] &lt;&lt; array[a] &lt;&lt; endl;

			}  // for(loop=0;loop&lt;63;loop++) {

			b++;

			if(b==62) {

				b=1;
				c++;;
			}

			if(c==63) {

				c=1;
				d++;

			}

			if(d==63) {

				d=1;
				e++;

			}

			if(e==63) {

				e=1;
				f++;

			}

			if(f==63) {

				f=1;
				g++;

			}

			if(g==63) {

				loop=12;

			}  // if(g==63) 

		}  // for(loop2=0;loop&lt;6;loop++) {

	} // else {

}  // int func_generate() {
</code></pre>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318289/c-rekursive-schleife-fehler</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 10:51:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318289.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Jul 2013 09:12:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Rekursive Schleife Fehler on Sun, 07 Jul 2013 09:12:58 GMT]]></title><description><![CDATA[<p>Moin!</p>
<p>Ich schreibe nebenbei an meinem PC einige kleinere Programme (aus Hobbygründen).<br />
Bei dem unten angegebenen Code soll auf dem Bildschrim und in eine txt Datei eine generierte Teichenfolge angezeigt bzw geschriebene werden.</p>
<p>Bloß wird nach dem ersten Buchstabendurchlauf (nach dem &quot;Z&quot;) nur eine &quot;0&quot; anzeigt,satt &quot;00&quot;.</p>
<p>Wo liegt der Fehler in dem Code?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;cstring&gt;

using namespace std;

ofstream dat_aus;

string dateiname2=&quot;datei.txt&quot;;

int loop;
int loop2;
int a;
int b;
int c;
int d;
int e;
int f;
int g;

// &quot;\0&quot; im in der variable &quot;array&quot; soll als leeres &quot;Zeichen&quot; bzw einfach nur leer sein

string array[63] = {&quot;\0&quot;,&quot;0&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,
					&quot;9&quot;,&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;,&quot;f&quot;,&quot;g&quot;,&quot;h&quot;,&quot;i&quot;,
					&quot;j&quot;,&quot;k&quot;,&quot;l&quot;,&quot;m&quot;,&quot;n&quot;,&quot;o&quot;,&quot;p&quot;,&quot;q&quot;,&quot;r&quot;,&quot;s&quot;,
					&quot;t&quot;,&quot;u&quot;,&quot;v&quot;,&quot;w&quot;,&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,
					&quot;D&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;I&quot;,&quot;J&quot;,&quot;K&quot;,&quot;L&quot;,&quot;M&quot;,
					&quot;N&quot;,&quot;O&quot;,&quot;P&quot;,&quot;Q&quot;,&quot;R&quot;,&quot;S&quot;,&quot;T&quot;,&quot;U&quot;,&quot;V&quot;,&quot;W&quot;,
					&quot;X&quot;,&quot;Y&quot;,&quot;Z&quot;};

int func_generate() {

	dat_aus.open(dateiname2.c_str(), ios_base::out);

  	if(!dat_aus) {

     	cout &lt;&lt; &quot;Datei konnte nicht geoeffnet werden!&quot;;
     	cout &lt;&lt; endl;
     	return -1;

  	}

	else {

		for(loop2=0;loop2&lt;6;loop2++) {

			loop2=0;

			for(a=0;a&lt;63;a++) {

				// Hier wird nach dem &quot;Z&quot; nur eine &quot;0&quot; statt &quot;00&quot; angezeigt

				cout &lt;&lt; array[g]&lt;&lt; array[f]  &lt;&lt; array[e] &lt;&lt; array[d] &lt;&lt; array[c] &lt;&lt; array[b] &lt;&lt; array[a] &lt;&lt; endl;
				dat_aus &lt;&lt; array[g]&lt;&lt; array[f]  &lt;&lt; array[e] &lt;&lt; array[d] &lt;&lt; array[c] &lt;&lt; array[b] &lt;&lt; array[a] &lt;&lt; endl;

			}  // for(loop=0;loop&lt;63;loop++) {

			b++;

			if(b==62) {

				b=1;
				c++;;
			}

			if(c==63) {

				c=1;
				d++;

			}

			if(d==63) {

				d=1;
				e++;

			}

			if(e==63) {

				e=1;
				f++;

			}

			if(f==63) {

				f=1;
				g++;

			}

			if(g==63) {

				loop=12;

			}  // if(g==63) 

		}  // for(loop2=0;loop&lt;6;loop++) {

	} // else {

}  // int func_generate() {
</code></pre>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337183</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337183</guid><dc:creator><![CDATA[user1401]]></dc:creator><pubDate>Sun, 07 Jul 2013 09:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Rekursive Schleife Fehler on Sun, 07 Jul 2013 09:40:01 GMT]]></title><description><![CDATA[<p>user1401 schrieb:</p>
<blockquote>
<pre><code>for(loop2=0;loop2&lt;6;loop2++) 
{
    loop2=0;
    ...
}
</code></pre>
</blockquote>
<p>Das oben zitierte Codestück ist erstmal sehr unüblich und müsste aus meiner Sicht sogar eine Endlosschleife ergeben. Falls das dein Ziel war: Endlosschleifen macht man anders <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>
<p>Der Threadtitel spricht von &quot;Rekursion&quot;. Ich sehe hier irgendwie keine...</p>
<p>Der Quellcode macht den Eindruck, als würde es Sinn machen, uns in den Sinn des Programmes einzuweihen, damit wir dir vielleicht allgemein helfen können, auch deinen Stil zu verbessern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337193</guid><dc:creator><![CDATA[It0101]]></dc:creator><pubDate>Sun, 07 Jul 2013 09:40:01 GMT</pubDate></item></channel></rss>