<?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[Ein array in eine zahl umwandeln?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche verzweifelt ein int array in ein int zahl umzwandeln!<br />
kann mir da jemand helfen?<br />
Danke im voraus!</p>
<p>Gruss neomay</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/131001/ein-array-in-eine-zahl-umwandeln</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 01:06:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/131001.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Dec 2005 21:28:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Thu, 29 Dec 2005 21:28:38 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche verzweifelt ein int array in ein int zahl umzwandeln!<br />
kann mir da jemand helfen?<br />
Danke im voraus!</p>
<p>Gruss neomay</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952432</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952432</guid><dc:creator><![CDATA[NeoMay]]></dc:creator><pubDate>Thu, 29 Dec 2005 21:28:38 GMT</pubDate></item><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Thu, 29 Dec 2005 21:36:50 GMT]]></title><description><![CDATA[<p>du meinst in ziffern oder was? beschreib mal etwas genauer was du vor hast</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952440</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952440</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Thu, 29 Dec 2005 21:36:50 GMT</pubDate></item><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Thu, 29 Dec 2005 21:49:43 GMT]]></title><description><![CDATA[<p>Falls die einzelnen Array Elemente die Ziffern einer Gesamtzahl darstellen soll ein Tipp:<br />
Die &quot;Wertigkeit&quot; eines Array-Elements erhältst du per a[i]*10^(L-i-1), wobei a ein int-Array, L die Länge von a und i der Index ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952451</guid><dc:creator><![CDATA[interpreter]]></dc:creator><pubDate>Thu, 29 Dec 2005 21:49:43 GMT</pubDate></item><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Thu, 29 Dec 2005 21:54:16 GMT]]></title><description><![CDATA[<p>[code]<br />
result = 0;<br />
length = Länge des Arrays;</p>
<p>// Man geht im wesentlichen das Array von hinten weg durch (-&gt; length - i)<br />
// (natuerlich nur sofern das letzte Element den geringsten Stellenwert hat,<br />
// ansonsten ist es genau umgekehrt) und zaehlt im Wesentlichen die Ziffer<br />
// umgerechnet mit dem Stellenwert hinzu.<br />
for(i = 0; i &lt; length; ++i)<br />
result = result + array[length - i] * radix ^ i;</p>
<p>// array[length - i]:<br />
// nächste Ziffer von hinten weg</p>
<p>// radix ^ i:<br />
// Stellenwert an der Position i, wobei radix die Basis des gewuenschten<br />
// Zahlensystems ist (z.B: 10 im dekadischen oder 2 im binären System)</p>
<p>// array[length - i] * radix ^ i:<br />
// Ergibt den Wert der Ziffer an ihrer Stelle. Konkretes Beispiel: 24<br />
// die Ziffer 2 ist an der Stelle 1 (von rechts weg gezählt) und hat<br />
// somit einen Wert von 2 * 10^1 : 20 -&gt; stimmt!</p>
<p>// result + array[length - i] * radix ^ i:<br />
// Es werden nun einfach iterativ alle Werte aufgezaehlt, bei 24 waere<br />
// das eben 20 + 4 .. was korrekterweise 24 ergibt.<br />
[code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952454</guid><dc:creator><![CDATA[öfgjsöfdlgöasdlfüpeksgsdf]]></dc:creator><pubDate>Thu, 29 Dec 2005 21:54:16 GMT</pubDate></item><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Fri, 30 Dec 2005 11:56:03 GMT]]></title><description><![CDATA[<p>Danke für die schnellen Antworten!<br />
@öfgjsöfdlgöasdlfüpeksgsdf die for schleife muss aber andersrum durchlaufen</p>
<pre><code class="language-cpp">for (int i=(length-1); i&gt;=0; i--)  
result = result + zahl[i]*pow(10,i);
</code></pre>
<p>(fals einer das gleiche Problem hat)</p>
<p>Danke an alle!<br />
Gruss NeoMay</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952661</guid><dc:creator><![CDATA[NeoMay]]></dc:creator><pubDate>Fri, 30 Dec 2005 11:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to Ein array in eine zahl umwandeln? on Fri, 30 Dec 2005 12:51:28 GMT]]></title><description><![CDATA[<p>NeoMay schrieb:</p>
<blockquote>
<p>Danke für die schnellen Antworten!<br />
@öfgjsöfdlgöasdlfüpeksgsdf die for schleife muss aber andersrum durchlaufen</p>
<pre><code class="language-cpp">for (int i=(length-1); i&gt;=0; i--)  
result = result + zahl[i]*pow(10,i);
</code></pre>
<p>(fals einer das gleiche Problem hat)</p>
<p>Danke an alle!<br />
Gruss NeoMay</p>
</blockquote>
<p>Benutz lieber das Hornerschema:</p>
<pre><code class="language-cpp">for (int i=(length-1); i&gt;=0; i--)  
result = result * 10 + zahl[i];
</code></pre>
<p>Wenn Σzahl[i]*10^i gewuenscht,<br />
ansonsten Schleife in anderer Richtung durchlaufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952699</guid><dc:creator><![CDATA[luser]]></dc:creator><pubDate>Fri, 30 Dec 2005 12:51:28 GMT</pubDate></item></channel></rss>