<?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[potenzrechnung]]></title><description><![CDATA[<p>hab ein problem mit meinem program und finde den fehler leider nicht.<br />
Es sollen potenzen rauskommen, auf dem papier klapt da program auch, aber bei c++ will es nicht laufen. In c++ kommt für c immer 0 raus obwohl für c der wert von z zugewisen werden soll.</p>
<pre><code class="language-csharp"># include &lt;iostream.h&gt;

int a,b,c;

void rechnen(int x,int y,int &amp;z)
{
if (y&lt;2)
z=x ;
        else
      y=y-1;
      z=z*x;
}
void main()
{
cout&lt;&lt;&quot;Geben sie die Zahlen nach dem Beispiel ein (Bsp. a^b)&quot;&lt;&lt; endl;
cout&lt;&lt;&quot;Wert fuer a:&quot;&lt;&lt;endl;
cin &gt;&gt;a;
cout&lt;&lt;&quot;Wert fuer b:&quot;&lt;&lt;endl;
cin &gt;&gt;b;
rechnen(a,b,c);
cout&lt;&lt;&quot;Das Egebnis ist:&quot;&lt;&lt;c&lt;&lt;endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/158250/potenzrechnung</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 15:52:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158250.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Sep 2006 14:01:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:01:37 GMT]]></title><description><![CDATA[<p>hab ein problem mit meinem program und finde den fehler leider nicht.<br />
Es sollen potenzen rauskommen, auf dem papier klapt da program auch, aber bei c++ will es nicht laufen. In c++ kommt für c immer 0 raus obwohl für c der wert von z zugewisen werden soll.</p>
<pre><code class="language-csharp"># include &lt;iostream.h&gt;

int a,b,c;

void rechnen(int x,int y,int &amp;z)
{
if (y&lt;2)
z=x ;
        else
      y=y-1;
      z=z*x;
}
void main()
{
cout&lt;&lt;&quot;Geben sie die Zahlen nach dem Beispiel ein (Bsp. a^b)&quot;&lt;&lt; endl;
cout&lt;&lt;&quot;Wert fuer a:&quot;&lt;&lt;endl;
cin &gt;&gt;a;
cout&lt;&lt;&quot;Wert fuer b:&quot;&lt;&lt;endl;
cin &gt;&gt;b;
rechnen(a,b,c);
cout&lt;&lt;&quot;Das Egebnis ist:&quot;&lt;&lt;c&lt;&lt;endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1130185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130185</guid><dc:creator><![CDATA[noob!]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:06:12 GMT]]></title><description><![CDATA[<p>So:</p>
<pre><code class="language-cpp">void rechnen(int x,int y,int &amp;z)
{
	z = x;

	while ( y-- )
	{
		z *= x;
	}
}
</code></pre>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130187</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:11:36 GMT]]></title><description><![CDATA[<p>hi, ich muss das program leider in meiner form aufschreibn, es soll ein rekursiver algorithmus sein.<br />
Das heißt das z wird solange einfach übernommen bis y&lt;2 ist und danach soll z ein wert zugewiesen werden und rekursiv ausgerechnet werden.</p>
<p>Freue mich über Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130189</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130189</guid><dc:creator><![CDATA[noob!]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:11:36 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:21:43 GMT]]></title><description><![CDATA[<p>Abgesehen davon das du garkeine Rekursion machst sind noch andere Denkfehler enthalten. z.B. hat z keinen brauchbaren Initialisierungswert.</p>
<p>Mein Beispiel:</p>
<pre><code class="language-cpp">int pot( int x, int y )
{
	if ( y &lt; 2 )
		return x;
	else
		return x*pot( x, --y );
}
</code></pre>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130194</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:21:43 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:25:35 GMT]]></title><description><![CDATA[<p>könntest du dann vielleicht ein beispiel für eine rekursion liefern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130196</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130196</guid><dc:creator><![CDATA[noob!]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:25:35 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:26:45 GMT]]></title><description><![CDATA[<p>Mein letztes Beispiel is doch eins! <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/1130197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130197</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:26:45 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:32:21 GMT]]></title><description><![CDATA[<p>das läuft bei mir so leider nicht :/...was muss ich noch alles schreiben damit c++ es laufen lässt?</p>
<p>danke schon mal für die geduld ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130199</guid><dc:creator><![CDATA[noob!]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:32:21 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:33:22 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;

int pot( int x, int y )
{
    if ( y &lt; 2 )
        return x;
    else
        return x*pot( x, --y );
}

int main()
{
  std::cout &lt;&lt; pot( 10, 2 ) &lt;&lt; std::endl;
}
</code></pre>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130201</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:33:22 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:36:08 GMT]]></title><description><![CDATA[<p>hm, bei mir wird das programm sofort abgebrochen ohne das ich was sehe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130203</guid><dc:creator><![CDATA[noob!]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:36:08 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:37:36 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Diese Frage wird so jeden Tag einmal gestellt, zum Beispiel <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-158156.html" rel="nofollow">hier</a>.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1130204</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130204</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:37:36 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 14:38:18 GMT]]></title><description><![CDATA[<p>Ach du mein Gott... Das is ja wohl wirklich [...]</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int pot( int x, int y )
{
    if ( y &lt; 2 )
        return x;
    else
        return x*pot( x, --y );
}

int main()
{
        std::cout &lt;&lt; pot( 10, 2 ) &lt;&lt; std::endl;

        std::cin.clear();
	std::cin.ignore( std::cin.rdbuf()-&gt;in_avail() );
	std::cin.get();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1130205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130205</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 03 Sep 2006 14:38:18 GMT</pubDate></item><item><title><![CDATA[Reply to potenzrechnung on Sun, 03 Sep 2006 20:44:00 GMT]]></title><description><![CDATA[<p>Der Vollständigkeit halber noch ne rechtsrekursive Version, obwohl ich nicht glaube, dass das irgendein C++-Compiler inlined:</p>
<pre><code class="language-cpp">int pow(int b, int e, int accu = 1)
{
    if (e == 0) return 1;
    if (e == 1) return b * accu;
    return pow(b, e - 1, b * accu);

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1130423</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1130423</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sun, 03 Sep 2006 20:44:00 GMT</pubDate></item></channel></rss>