<?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[Grundlagen]]></title><description><![CDATA[<p>Ich möchte ein Programm schreiben das x^n berechnet. Es soll einfach auf der Konsole x und n einlesen und dann rechnen. Leider funktioniert das so wie ich es mir denke noch nicht. Es kommt immer 0 raus. Wo ist da mein denkfehler?</p>
<p>void main ()<br />
{<br />
float x;<br />
int n;<br />
int ergebnis;<br />
int zaehler=0;<br />
printf(&quot;Bitte geben sie erst die Basis und dann den Exponenten ein!\n&quot;);<br />
scanf(&quot;%f&quot;, &amp;x);<br />
scanf(&quot;%d&quot;, &amp;n);<br />
ergebnis=x;<br />
while(zaehler&lt;=n)<br />
{<br />
ergebnis=ergebnis*x;<br />
zaehler++;<br />
}<br />
printf(&quot;%f&quot;, ergebnis);</p>
<p>}</p>
<p>Wo ist da der Fehler?<br />
Vieleicht kann mir ja jemand helfen....<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/125376/grundlagen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 12:42:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/125376.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Nov 2005 12:20:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 12:20:51 GMT]]></title><description><![CDATA[<p>Ich möchte ein Programm schreiben das x^n berechnet. Es soll einfach auf der Konsole x und n einlesen und dann rechnen. Leider funktioniert das so wie ich es mir denke noch nicht. Es kommt immer 0 raus. Wo ist da mein denkfehler?</p>
<p>void main ()<br />
{<br />
float x;<br />
int n;<br />
int ergebnis;<br />
int zaehler=0;<br />
printf(&quot;Bitte geben sie erst die Basis und dann den Exponenten ein!\n&quot;);<br />
scanf(&quot;%f&quot;, &amp;x);<br />
scanf(&quot;%d&quot;, &amp;n);<br />
ergebnis=x;<br />
while(zaehler&lt;=n)<br />
{<br />
ergebnis=ergebnis*x;<br />
zaehler++;<br />
}<br />
printf(&quot;%f&quot;, ergebnis);</p>
<p>}</p>
<p>Wo ist da der Fehler?<br />
Vieleicht kann mir ja jemand helfen....<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909346</guid><dc:creator><![CDATA[tomoffel123]]></dc:creator><pubDate>Sun, 06 Nov 2005 12:20:51 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 12:24:03 GMT]]></title><description><![CDATA[<p>Mal abgesehen davonb, das du hier im falschen Forum bist.</p>
<p>Du kannst einen integer nicht mit dem Platzhalter %f ausgeben, der ist nur für die Datentypen float und double. Du must %i verwenden, also:</p>
<pre><code>printf(&quot;%i&quot;, ergebnis);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/909349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909349</guid><dc:creator><![CDATA[Zerebus]]></dc:creator><pubDate>Sun, 06 Nov 2005 12:24:03 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 12:26:49 GMT]]></title><description><![CDATA[<p>Frag das nächste mal im Ansi C o. C++ Forum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909353</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sun, 06 Nov 2005 12:26:49 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 13:05:16 GMT]]></title><description><![CDATA[<p>Sorry, ich packs nächstes mal ins andere Forum...</p>
<p>Ich hab's nun so gemacht:<br />
Leider liefert das Programm immernoch ein falsches Ergebnis. Ich weis nicht was ich falsch mache.</p>
<p>void main ()<br />
{<br />
float x;<br />
int n;<br />
float ergebnis;<br />
int zaehler=0;<br />
printf(&quot;Bitte geben sie erst die Basis und dann den Exponenten ein!\n&quot;);<br />
scanf(&quot;%f&quot;, &amp;x);<br />
scanf(&quot;%d&quot;, &amp;n);<br />
ergebnis=x;<br />
printf(&quot;Ergenis %f&quot;, &amp;ergebnis);<br />
while(zaehler&lt;=n)<br />
{<br />
ergebnis=ergebnis*x;<br />
zaehler++;<br />
//printf(&quot;%f&quot;,ergebnis);<br />
}<br />
printf(&quot;%f&quot;, ergebnis);</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909407</guid><dc:creator><![CDATA[tomoffel123]]></dc:creator><pubDate>Sun, 06 Nov 2005 13:05:16 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 13:07:56 GMT]]></title><description><![CDATA[<p>versuche es doch mal mit pow(double, double)<br />
--&gt; Is in in &lt;math.h&gt; definiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909414</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sun, 06 Nov 2005 13:07:56 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 13:10:51 GMT]]></title><description><![CDATA[<p>Ich sollte das schon selber programmieren und keine vordefinierte Funktion nutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909418</guid><dc:creator><![CDATA[tomoffel123]]></dc:creator><pubDate>Sun, 06 Nov 2005 13:10:51 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 13:53:33 GMT]]></title><description><![CDATA[<p>vll versuchst du statt dem printf und scanf lieber cout und cin zur ein- und Ausgabe=? Ist leichter weil man da nicht so viele mit den Parametern beachten muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909488</guid><dc:creator><![CDATA[Kevinus]]></dc:creator><pubDate>Sun, 06 Nov 2005 13:53:33 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 14:09:02 GMT]]></title><description><![CDATA[<p>warum cout --&gt;es ist doich ne C-Application, soviel Schreibarbeit ist das nun auch wieder nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909509</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sun, 06 Nov 2005 14:09:02 GMT</pubDate></item><item><title><![CDATA[Reply to Grundlagen on Sun, 06 Nov 2005 14:31:16 GMT]]></title><description><![CDATA[<p>Ich habs nun hinbekommen. Danke nochmal für eure hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909540</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909540</guid><dc:creator><![CDATA[tomoffel123]]></dc:creator><pubDate>Sun, 06 Nov 2005 14:31:16 GMT</pubDate></item></channel></rss>