<?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[Teilerberechnung mit Do-While Schleife]]></title><description><![CDATA[<p>Hey,<br />
Ich möchte ein Programm schreiben, dass alle Teiler einer Zahl berechnet. Das soweit kein Problem.<br />
Nur möchte ich es so machen, dass man jedes mal nach der Ausgabe der Teiler, wieder eine neue Zahl eingibt und es wieder berechnet, so lange bis man mal 0 eingibt, dann soll das Programm beendet werden.<br />
In meinem Programm geht ein Durchlauf gut, dann komm ich wieder zur Eingabe der Zahl, doch dann passiert nichts mehr, keine Berechnung.<br />
Mfg</p>
<pre><code class="language-cpp">int main ()
{
	int b, t, a;
	b=1;
	do{
	cout &lt;&lt; &quot;\n Zahl eingeben : &quot;;
	cin &gt;&gt; a;

	while(b &lt;= a){
		t= a%b;
		if(t==0){
			cout &lt;&lt; b &lt;&lt; endl;
		}

		b=b+1;
	}
}
	while (a !=0);

system(&quot;PAUSE&quot;);

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/296675/teilerberechnung-mit-do-while-schleife</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 19:28:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/296675.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Dec 2011 17:45:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Teilerberechnung mit Do-While Schleife on Fri, 09 Dec 2011 17:45:38 GMT]]></title><description><![CDATA[<p>Hey,<br />
Ich möchte ein Programm schreiben, dass alle Teiler einer Zahl berechnet. Das soweit kein Problem.<br />
Nur möchte ich es so machen, dass man jedes mal nach der Ausgabe der Teiler, wieder eine neue Zahl eingibt und es wieder berechnet, so lange bis man mal 0 eingibt, dann soll das Programm beendet werden.<br />
In meinem Programm geht ein Durchlauf gut, dann komm ich wieder zur Eingabe der Zahl, doch dann passiert nichts mehr, keine Berechnung.<br />
Mfg</p>
<pre><code class="language-cpp">int main ()
{
	int b, t, a;
	b=1;
	do{
	cout &lt;&lt; &quot;\n Zahl eingeben : &quot;;
	cin &gt;&gt; a;

	while(b &lt;= a){
		t= a%b;
		if(t==0){
			cout &lt;&lt; b &lt;&lt; endl;
		}

		b=b+1;
	}
}
	while (a !=0);

system(&quot;PAUSE&quot;);

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2155121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2155121</guid><dc:creator><![CDATA[Martin89]]></dc:creator><pubDate>Fri, 09 Dec 2011 17:45:38 GMT</pubDate></item><item><title><![CDATA[Reply to Teilerberechnung mit Do-While Schleife on Fri, 09 Dec 2011 17:47:29 GMT]]></title><description><![CDATA[<p>Du vergisst b neu zu setzen. Allgemein würde sich eine for Schleife eher anbieten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2155122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2155122</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Fri, 09 Dec 2011 17:47:29 GMT</pubDate></item><item><title><![CDATA[Reply to Teilerberechnung mit Do-While Schleife on Fri, 09 Dec 2011 18:28:20 GMT]]></title><description><![CDATA[<p>Vielen dank, da war ich wohl blind <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Hab das jetzt mit for-schleife gemacht, ist echt viel Übersichtlicher.<br />
Danke nochmal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2155139</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2155139</guid><dc:creator><![CDATA[Martin89]]></dc:creator><pubDate>Fri, 09 Dec 2011 18:28:20 GMT</pubDate></item></channel></rss>