<?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[Brauche Hilfe bei Schleife]]></title><description><![CDATA[<p>Hallo zusammen, ich bräuchte mal eure Hilfe, also wir sollen für die Schule folgendes programm programmieren:</p>
<blockquote>
<p>Entwickeln Sie ein Programm, das den Ausdruck (Hoch 2, Wurzel aus 2)berechnet<br />
Hinweise zur programmierung:</p>
<p>Erzeugen Sie eine Folge von Positiven Zahlen, deren Quadrate sich der Zahl 2 immer mehr nähren. Führe Sie zu diesem Zweck folgende Anweisungen durch:</p>
<ol>
<li>a=1; b=2</li>
<li>c=(a+b)/2</li>
<li>Wenn c*c&gt;2 dann b=c<br />
sonst a=c</li>
<li>weiter bei 1.</li>
</ol>
</blockquote>
<p>So uns wurde zusätzlich gesagt das wir als schleife die for schleife verwenden sollen, nur leider weis ich nicht wie ich das programm umsätzen soll, ich sitz bereits seit 2 Tagen dran, bekomm das aber nie raus.</p>
<p>Danke schonmal für eure Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/192671/brauche-hilfe-bei-schleife</link><generator>RSS for Node</generator><lastBuildDate>Sun, 27 Sep 2026 14:44:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/192671.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Sep 2007 12:58:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 12:58:47 GMT]]></title><description><![CDATA[<p>Hallo zusammen, ich bräuchte mal eure Hilfe, also wir sollen für die Schule folgendes programm programmieren:</p>
<blockquote>
<p>Entwickeln Sie ein Programm, das den Ausdruck (Hoch 2, Wurzel aus 2)berechnet<br />
Hinweise zur programmierung:</p>
<p>Erzeugen Sie eine Folge von Positiven Zahlen, deren Quadrate sich der Zahl 2 immer mehr nähren. Führe Sie zu diesem Zweck folgende Anweisungen durch:</p>
<ol>
<li>a=1; b=2</li>
<li>c=(a+b)/2</li>
<li>Wenn c*c&gt;2 dann b=c<br />
sonst a=c</li>
<li>weiter bei 1.</li>
</ol>
</blockquote>
<p>So uns wurde zusätzlich gesagt das wir als schleife die for schleife verwenden sollen, nur leider weis ich nicht wie ich das programm umsätzen soll, ich sitz bereits seit 2 Tagen dran, bekomm das aber nie raus.</p>
<p>Danke schonmal für eure Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366952</guid><dc:creator><![CDATA[Nero91]]></dc:creator><pubDate>Mon, 17 Sep 2007 12:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 12:59:32 GMT]]></title><description><![CDATA[<p>zeig mal was du in den 2 tagen gemacht hast</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366953</guid><dc:creator><![CDATA[na dann]]></dc:creator><pubDate>Mon, 17 Sep 2007 12:59:32 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:00:44 GMT]]></title><description><![CDATA[<p>Ich empfehle dir ein Grundlagenbuch, bevor du mit solchen &quot;schweren&quot; Aufgaben anfängst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366956</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366956</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:00:44 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:08:49 GMT]]></title><description><![CDATA[<p>Das ist ne aufgabe die wir als Hausaufgabe von der Schule aufhaben.</p>
<pre><code>#include &lt;stdio.h&gt;

main()
{
	int a=1, b=2, c;
	printf(&quot;\n\tProgramm zur Berechnung von Wurzel 2&quot;);

		for(c=(a+b)/2; c*c&gt;2; c=c*c);
		{
		b=c;
		}
		printf(&quot;\n\n&quot;);
		printf(&quot;\tWurzel 2= %i&quot;,b);
}
</code></pre>
<p>Ich hab mir das in etwa so gedacht, nur leider weis ich net, wie ich das jetzt mit der For schleife machen soll.<br />
Wir haben gerade erst damit angefangen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366959</guid><dc:creator><![CDATA[Nero91]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:08:41 GMT]]></title><description><![CDATA[<p>Sehr &quot;kreative&quot; Formatierung.<br />
Welchen Sinn haben die geschweiften Klammern nach der for-Schleife?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366962</guid><dc:creator><![CDATA[TomasRiker]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:08:41 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:10:44 GMT]]></title><description><![CDATA[<p>OK, dann fang nochmal von vorne an:</p>
<ol>
<li>Erste Lektion: Wie funktionieren Schleifen?</li>
<li>Zweite Lektion: Wie funktioniert eine Verzweigung? (wenn/dann/sonst)</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/1366966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366966</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:12:58 GMT]]></title><description><![CDATA[<p>Bei der Aufgabe macht eine for-schleife nur in sofern sinn, dass man die Anzahl der der Durchgänge begrenzen kann. So wie es oben angegeben ist, ist es ja eine Endlosschleife. Du kannst es also nicht endlos oft machen, sondern nur eine bestimmte Anzahl von durchgängen mit der for-schleife machen.</p>
<p>Das &quot;4) weiter bei <strong>1</strong>.&quot; macht aber sowieso keinen Sinn, weil dann ja immer das gleiche gerechnet wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366968</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366968</guid><dc:creator><![CDATA[na dann]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:16:17 GMT]]></title><description><![CDATA[<p>Ja das ist leider so eine scheiss aufgabe aus der schule die sich unser Lehrer ausgedacht hat, umm uns schüler zu ärgern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366969</guid><dc:creator><![CDATA[Nero91]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:16:17 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:20:43 GMT]]></title><description><![CDATA[<p>Nero91 schrieb:</p>
<blockquote>
<ol>
<li>a=1; b=2</li>
</ol>
</blockquote>
<p>Der Teil kommt vor die Schleife, um die beteiligten Variablen zu initialisieren</p>
<blockquote>
<ol start="2">
<li>c=(a+b)/2</li>
<li>Wenn c*c&gt;2 dann b=c<br />
sonst a=c</li>
</ol>
</blockquote>
<p>Der Teil kommt als Anweisung in den Schleifenrumpf</p>
<blockquote>
<ol start="4">
<li>weiter bei 1.</li>
</ol>
</blockquote>
<p>Das sollte wohl eher &quot;weiter bei 2.&quot; heißen - und stellt den Schleifenkopf dar. Außerdem solltest du dir noch ein Abbruchkriterium überlegen, mit dem du die Schleife verlassen kannst.</p>
<p>(PS: Für die Aufgabe würde ich eher eine do-while-Schleife verwenden)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366973</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:29:04 GMT]]></title><description><![CDATA[<p>oehm, int als Datentyp ist vielleicht nicht ratsam, nimm lieber double a=1.0, b=2.0, c=0.0</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366981</guid><dc:creator><![CDATA[i_like_it]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:29:04 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:32:57 GMT]]></title><description><![CDATA[<p>evt. so?=</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

double radical(double value, std::size_t approx)
{
	if (value == 0.0 || value == 1.0) return value;

	double a = 1.0, b = 2.0;
	for (; approx &gt; 0; --approx)
	{
		double c = ((a + b) / 2.0);
		if ((c * c) &gt; 2.0)
			b = c;
		else 
			a = c;
	}
	return a;
}

int main()
{
	std::cout	&lt;&lt; &quot;Wuzel² Berechnung V0.1\n&quot;
				&lt;&lt; &quot;Zahl: &quot; &lt;&lt; std::flush;
	double value = 0.0;
	std::cin &gt;&gt; value;
	std::cout	&lt;&lt; &quot;Annäherungen: &quot; &lt;&lt; std::flush;
	std::size_t approx = 1;
	std::cin &gt;&gt; approx;
	std::cout &lt;&lt; radical(value, approx) &lt;&lt; std::endl;
}
</code></pre>
<p>... ist allerdings nen komischer Algo ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366986</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:32:57 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Schleife on Mon, 17 Sep 2007 13:35:08 GMT]]></title><description><![CDATA[<p>achja ... power sollt ihr dann bestimmt nachher auch schreiben <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>
<pre><code class="language-cpp">namespace math
{
	template &lt;typename T&gt;
	T power(T const&amp; value, std::size_t expo)
	{	return value * power&lt;T&gt;(value, expo - 1);	}
};
</code></pre>
<p>... ist nicht die beste Implementierung ... aber sollte gehen <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/1366987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366987</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 17 Sep 2007 13:35:08 GMT</pubDate></item></channel></rss>