<?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[addiert nicht]]></title><description><![CDATA[<p>habe gerade mit c++ begonnen und ein vorprogramm zu einem Spaßwahrscheinlichkeitsrechner (statistik).<br />
(kann sein, dass es unübersichtlich ist)</p>
<p>mein Problem: b kann eifach nicht addiert werden siehe oma<br />
außerdem, auch fertig ist es wahrscheinlich stark verbesserugswürdig</p>
<p>es soll berechnen Σ n (8) über k * 0.51^k * 0.49^k<br />
oder ein Teil davon, halt ein vorprogramm</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt; 
#include &lt;conio.h&gt;

using namespace std;

double hoch(double i, int b)
{
       int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return i;
};

int hochexp(double i, int b)
{
    int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return expzaehler;
};

double Fak (double i)
{
       int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return i;
};

int expFak (double i)
{
    int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return expzaehler;
};

int main()
{
    int n = 8;
    int t = 0;
    double kk = 0.0;
    int expkk = 0;
    double tt = 0.0;
    int exptt = 0;
    double hk = 0.0;
    double hnk = 0.0;
    int exphk, exphnk;
    double a = 0.0;
    double b = 0.0;
    int bb;
    double aa;
    double p = 0.51;
    double q = 0.49;
    double nn = Fak(n);
    int expnn = expFak(n);
    double oma = 0.0;
    for(int k = 0;k&lt;4; k++)
         {
              cout&lt;&lt;&quot;nn ( die ! von n als zahl = &quot;&lt;&lt;nn&lt;&lt;endl;
              cout&lt;&lt;&quot;nn`s exponentenzahl: &quot;&lt;&lt;expnn&lt;&lt;endl;
                 t = n - k;
                 cout&lt;&lt;&quot;t = &quot;&lt;&lt;t&lt;&lt;endl;
                 kk = Fak(k);
                 cout&lt;&lt;&quot;kk = &quot;&lt;&lt;kk&lt;&lt;endl;
                 expkk = expFak(k);
                 cout&lt;&lt;&quot;expkk = &quot;&lt;&lt;expkk&lt;&lt;endl;
                 tt = Fak(t);
                 cout&lt;&lt;&quot;tt = &quot;&lt;&lt;tt&lt;&lt;endl;
                 exptt = expFak(t);
                 cout&lt;&lt;&quot;exptt = &quot;&lt;&lt;exptt&lt;&lt;endl;
                 hk = hoch(p,k);
                 cout&lt;&lt;&quot;hk = &quot;&lt;&lt;hk&lt;&lt;endl;
                 hnk = hoch(q,t);
                 cout&lt;&lt;&quot;hnk = &quot;&lt;&lt;hnk&lt;&lt;endl;
                 exphk = hochexp (p,k);
                 cout&lt;&lt;&quot;exphk = &quot;&lt;&lt;exphk&lt;&lt;endl;
                 exphnk = hochexp (q,t);
                 cout&lt;&lt;&quot;exphnk = &quot;&lt;&lt;exphnk&lt;&lt;endl;
                 a = nn/(kk*tt);
                 cout&lt;&lt;&quot;a = &quot;&lt;&lt;a&lt;&lt;endl;
                 aa = expnn-expkk-exptt;
                 cout&lt;&lt;&quot;aa = &quot;&lt;&lt;aa&lt;&lt;endl;
                         b = (a * hk * hnk) ;
                                   oma+=b;        //hier
                                   cout&lt;&lt;&quot;oma = &quot;&lt;&lt;oma&lt;&lt;endl;

                 cout&lt;&lt;&quot;b = &quot;&lt;&lt;b&lt;&lt;endl;
                 bb = aa- exphk - exphnk;  //? kann sein, dass 0,51 trotzdem einen exp ergibt
                 cout&lt;&lt;&quot;bb = &quot;&lt;&lt;bb&lt;&lt;endl;

         }
         cout&lt;&lt;b&lt;&lt;endl;
         getch();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/294736/addiert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 19:07:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294736.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 Oct 2011 15:13:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 15:13:38 GMT]]></title><description><![CDATA[<p>habe gerade mit c++ begonnen und ein vorprogramm zu einem Spaßwahrscheinlichkeitsrechner (statistik).<br />
(kann sein, dass es unübersichtlich ist)</p>
<p>mein Problem: b kann eifach nicht addiert werden siehe oma<br />
außerdem, auch fertig ist es wahrscheinlich stark verbesserugswürdig</p>
<p>es soll berechnen Σ n (8) über k * 0.51^k * 0.49^k<br />
oder ein Teil davon, halt ein vorprogramm</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt; 
#include &lt;conio.h&gt;

using namespace std;

double hoch(double i, int b)
{
       int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return i;
};

int hochexp(double i, int b)
{
    int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return expzaehler;
};

double Fak (double i)
{
       int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return i;
};

int expFak (double i)
{
    int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return expzaehler;
};

int main()
{
    int n = 8;
    int t = 0;
    double kk = 0.0;
    int expkk = 0;
    double tt = 0.0;
    int exptt = 0;
    double hk = 0.0;
    double hnk = 0.0;
    int exphk, exphnk;
    double a = 0.0;
    double b = 0.0;
    int bb;
    double aa;
    double p = 0.51;
    double q = 0.49;
    double nn = Fak(n);
    int expnn = expFak(n);
    double oma = 0.0;
    for(int k = 0;k&lt;4; k++)
         {
              cout&lt;&lt;&quot;nn ( die ! von n als zahl = &quot;&lt;&lt;nn&lt;&lt;endl;
              cout&lt;&lt;&quot;nn`s exponentenzahl: &quot;&lt;&lt;expnn&lt;&lt;endl;
                 t = n - k;
                 cout&lt;&lt;&quot;t = &quot;&lt;&lt;t&lt;&lt;endl;
                 kk = Fak(k);
                 cout&lt;&lt;&quot;kk = &quot;&lt;&lt;kk&lt;&lt;endl;
                 expkk = expFak(k);
                 cout&lt;&lt;&quot;expkk = &quot;&lt;&lt;expkk&lt;&lt;endl;
                 tt = Fak(t);
                 cout&lt;&lt;&quot;tt = &quot;&lt;&lt;tt&lt;&lt;endl;
                 exptt = expFak(t);
                 cout&lt;&lt;&quot;exptt = &quot;&lt;&lt;exptt&lt;&lt;endl;
                 hk = hoch(p,k);
                 cout&lt;&lt;&quot;hk = &quot;&lt;&lt;hk&lt;&lt;endl;
                 hnk = hoch(q,t);
                 cout&lt;&lt;&quot;hnk = &quot;&lt;&lt;hnk&lt;&lt;endl;
                 exphk = hochexp (p,k);
                 cout&lt;&lt;&quot;exphk = &quot;&lt;&lt;exphk&lt;&lt;endl;
                 exphnk = hochexp (q,t);
                 cout&lt;&lt;&quot;exphnk = &quot;&lt;&lt;exphnk&lt;&lt;endl;
                 a = nn/(kk*tt);
                 cout&lt;&lt;&quot;a = &quot;&lt;&lt;a&lt;&lt;endl;
                 aa = expnn-expkk-exptt;
                 cout&lt;&lt;&quot;aa = &quot;&lt;&lt;aa&lt;&lt;endl;
                         b = (a * hk * hnk) ;
                                   oma+=b;        //hier
                                   cout&lt;&lt;&quot;oma = &quot;&lt;&lt;oma&lt;&lt;endl;

                 cout&lt;&lt;&quot;b = &quot;&lt;&lt;b&lt;&lt;endl;
                 bb = aa- exphk - exphnk;  //? kann sein, dass 0,51 trotzdem einen exp ergibt
                 cout&lt;&lt;&quot;bb = &quot;&lt;&lt;bb&lt;&lt;endl;

         }
         cout&lt;&lt;b&lt;&lt;endl;
         getch();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2138280</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138280</guid><dc:creator><![CDATA[rga]]></dc:creator><pubDate>Mon, 31 Oct 2011 15:13:38 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 15:28:40 GMT]]></title><description><![CDATA[<p>Die Addition, so wie du sie notiert hast, ist mit Sicherheit ok. Es liegt eher an deinen Werten. Wenn <code>oma</code> sich nicht verändert, ist <code>b</code> wohl 0.</p>
<p>EDIT: Setze dir am besten mal mit dem Debugger einen Haltepunkt und schau dir selbst an, welche Werte in den Variablen stehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138286</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 31 Oct 2011 15:28:40 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 15:40:44 GMT]]></title><description><![CDATA[<p>Man darf Variablen übrigens auch Namen mit mehr als 1-3 Buchstaben geben. Das ist ganz nützlich, wenn man 15 verschiedene im gleichen Kontext hat. Ich empfehle _, __, ___, ____, _____, usw. als Bezeichner, dann ist es gleich viel leserlicher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138293</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 31 Oct 2011 15:40:44 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 15:41:47 GMT]]></title><description><![CDATA[<p>Das ist, bis auf den ersten, UB.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138295</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Mon, 31 Oct 2011 15:41:47 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 15:48:48 GMT]]></title><description><![CDATA[<p>314159265358979 schrieb:</p>
<blockquote>
<p>Das ist, bis auf den ersten, UB.</p>
</blockquote>
<p>Der erste auch, wenn es im globalen Namensraum ist. Aber wirklich undefiniert würde ich das nicht nennen. Es kann halt zu Namenskonflikten kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138300</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 31 Oct 2011 15:48:48 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 16:37:27 GMT]]></title><description><![CDATA[<p>rga schrieb:</p>
<blockquote>
<p>es soll berechnen Σ n (8) über k * 0.51^k * 0.49^k</p>
</blockquote>
<p>Bitte was?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138335</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Mon, 31 Oct 2011 16:37:27 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 19:37:14 GMT]]></title><description><![CDATA[<p>Michael E. schrieb:</p>
<blockquote>
<p>rga schrieb:</p>
<blockquote>
<p>es soll berechnen Σ n (8) über k * 0.51^k * 0.49^k</p>
</blockquote>
<p>Bitte was?</p>
</blockquote>
<p><a href="http://de.wikipedia.org/wiki/Binomialkoeffizient" rel="nofollow">http://de.wikipedia.org/wiki/Binomialkoeffizient</a><br />
habe hier noch nicht gefunden, wie ich n über k als Formel schreibe.<br />
Anders auch n! / (k! * (n-k)!<br />
damit dann weiter mit * p (also 0.51) hoch k * q (also 0.49) hoch (n-k)<br />
und diese schleife geht von kanfang= 0 bis if(n%2 != 1){ kende= (n/2) -1 }<br />
und wenn n ungerade ist, dann kende = (n-1) / 2</p>
<p>es kommen oft massive exponenten raus zB 6660! wird schon mal zu 1,7699 <em>10^22574<br />
deswegen habe ich nen exponentenzähler eingebaut, der jedesmal wenn eine Fakultät (oder Potenz) über 10 kommt er /10 teilt, solange bis die variable einen Wert unter 10 hat. Leider bekommt man bei Funktionen immer nur einen rückgabewert, deswegen musste ich meine 2 Funktionen (Fakultät und Potenz) verdoppeln einmal mit dem Wert und einmal mit dem Exponenten. Teilt man zahlen werden die Exponenten subtrahiert zB werden aus 4*10hoch^20 / 2*10hoch^10 = 2</em>10hoch10.<br />
Wenn kende erreicht wird und die gewünschte wahrscheinlichkeit noch nicht erreicht ist wird n um 1 erhöht und so weiter.</p>
<p>Ein Beispiel für so ne Aufgabe:<br />
Wie viele Spiele muss man spielen damit bei einer Gewinnwahrscheinlichkeit von 51% (also 0.51) die chacne mehr Spiele zu verlieren als zu gewinnen bei unter 5% liegt?</p>
<p>Die Antwort 6662 Spiele.</p>
<p>n ist die Spielanzahl<br />
also Σ (6660 über k) * 0.51^k * 0.49^(6660-k) = 0.0500205074<br />
(dabei k anfang = 0 und k ende = 3329)</p>
<p><strong>Σ</strong> (6661 über k) * 0.51^k * 0.49^(6661-k) = 0.051284226<br />
(dabei k anfang = 0 und k ende = 3330)</p>
<p>Σ (6662 über k) * 0.51^k * 0.49^(6662-k) = <strong>0.0499954186</strong><br />
(dabei k anfang = 0 und k ende = 3330)</p>
<p>nun mein Programm, welches ich vorher hatte. (da müssten noch ein paar Fehler drinne sein wo genau weiß ich nicht, deswegen wollte ich es auseinanderbauen und mit kleinen Zahlen testen siehe oben)</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
#include &lt;cstdlib&gt; 
#include &lt;conio.h&gt;
#include &lt;math.h&gt;

using namespace std;

double hoch(double i, int b)
{
       int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return i;
};

int hochexp(double i, int b)
{
    int expzaehler = 0;
       double ii = i;
       for(;b&gt;1;b--)
    {
            i*=ii;

            if(i&lt;1)
            {
                   for(;i&lt;1;)
                   {
                             i*=10;
                             expzaehler++;
                   }
            }
    }
    return expzaehler;
};

double Fak (double i)
{
       int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return i;
};

int expFak (double i)
{
    int expzaehler = 0;
       double k = i-1;
       for(; k&gt;1; k--)
    {
            i*=k;
            if(i&gt;10)
            {
                    for(;i&gt;10;)
                    {

                         i/= 10;
                         expzaehler++;
                    }
            }
    }
    return expzaehler;
};

int main()
{
    double wahrscheinlichkeit = 1.0;
    double nn = 0.0;
    double kk = 0.0;
    int expnn = 0;
    int expkk=0;
    double hk = 0.0;
    double hnk = 0.0; 
    double tt = 0.0;
    int exptt = 0;
    int exphk = 0;
    int exphnk=0;
    int aa=0;
    int bb=0;
    double a = 0.0;
    double b = 0.0;
    int nspeicher = 0;
    int ende = 0;
    double p = 0.0;
    double q = 0.0;
    cout&lt;&lt; &quot;gebe die gewinnwahrscheinlichkeit ein&quot;&lt;&lt;endl;
    cin &gt;&gt; p;
    cout&lt;&lt;&quot;gebe die verlierwahrscheinlichkeit ein&quot;&lt;&lt;endl;
    cin &gt;&gt;q;
    for( int n = 4; wahrscheinlichkeit&gt;0.05 ; n++)
    {
         b = 0;
         wahrscheinlichkeit = 0.0;
         nspeicher = n;
         nn = Fak(n);
         expnn = expFak(n);
         if(n%2 != 1)
         {
                ende = n / 2 -1;

         }
         if(n%2 == 1)
         {
                ende = (n-1) / 2;
         }
         for(int k = 1;k&lt;(ende+1); k++)
         {
                 int t = n - k;
                 kk = Fak(k);
                 expkk = expFak(k);
                 tt = Fak(t);
                 exptt = expFak(t);
                 hk = hoch(p,k);
                 hnk = hoch(q,t);
                 exphk = hochexp (p,k);
                 exphnk = hochexp (q,t);
                 a = nn/(kk*tt);
                 aa = expnn-expkk-exptt;
                 b = b+ a * hk * hnk;
                 bb = aa- exphk - exphnk;  //? kann sein, dass 0,51 trotzdem einen exp ergibt

         }
                 if(bb&gt;0)
                 {
                         cout&lt;&lt;bb&lt;&lt;&quot;test1&quot;&lt;&lt;endl;
                         for(;bb&gt;0;bb--)
                 {
                                b*= 10;
                 }
                 }
                 if(bb&lt;0)
                 {
                         cout&lt;&lt;bb&lt;&lt;&quot;test2&quot;&lt;&lt;endl;
                         for(;bb&lt;0;bb++)
                         {
                                        b/=10;
                         }
                         cout&lt;&lt;bb&lt;&lt;endl;
                 }
                 cout&lt;&lt;b&lt;&lt;endl;
                 cout&lt;&lt;&quot;das n ist&quot;&lt;&lt;n&lt;&lt;endl;
                 wahrscheinlichkeit = b;
                 cout&lt;&lt;&quot;die w ist = &quot;&lt;&lt;wahrscheinlichkeit&lt;&lt;endl;
         }
         cout&lt;&lt;&quot;Fakultät von 6660 =&quot;&lt;&lt;Fak(6660)&lt;&lt;&quot;mit dem exponenten&quot;&lt;&lt;expFak(6660)&lt;&lt;endl;
         cout&lt;&lt;&quot;die von 3329 ist= &quot;&lt;&lt;Fak(3329)&lt;&lt;&quot;mit dem exponenten&quot;&lt;&lt;expFak(3329)&lt;&lt;endl;
         cout&lt;&lt;&quot; 0,51hoch3329ist = &quot;&lt;&lt;hoch(p,3329)&lt;&lt;&quot;mit dem exponenten&quot;&lt;&lt;hochexp(p,3329)&lt;&lt;endl;
         cout&lt;&lt;&quot;0,49hoch3331 ist = &quot;&lt;&lt;hoch(q,3331)&lt;&lt;&quot;mit dem exponenten&quot;&lt;&lt;hochexp(q,3331)&lt;&lt;endl;

    cout&lt;&lt;&quot;nach &quot;&lt;&lt;nspeicher&lt;&lt;&quot;Spielen beträgt die wahrsch. mehr zu verlieren unter 5%&quot;&lt;&lt;endl;
    getch();
}
</code></pre>
<p>man kann möglicherweise erkennen, dass ich es teilweise umständlicher und länger als nötig gemacht habe, weil ich noch nicht wircklich Erfahrung mit c++ habe. Tipps zu bestimmten Zeilen könnte ich also gut gebrauchen zB wo ich Zeilen einsparen könnte. Vermutlich könnte ich auch math.h benutzen, jetzt hab ich aber schon ohne angefangen und es ist vermutlich auch keine schande seine Rechenoptionen selber zu programmieren.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138409</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138409</guid><dc:creator><![CDATA[rga]]></dc:creator><pubDate>Mon, 31 Oct 2011 19:37:14 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 19:49:11 GMT]]></title><description><![CDATA[<p>nochmal erwähnenswert: das erste Programm war eig schon 100% richtig, was die Ergebnisse belangt. Manuell gerechnet habe ich das Gleiche raus. Das Problem war schlicht, dass man die einzelnen b nicht addieren konnte (oma).<br />
(Siehe Summe in meiner Formel oben)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138415</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138415</guid><dc:creator><![CDATA[rga]]></dc:creator><pubDate>Mon, 31 Oct 2011 19:49:11 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 19:54:34 GMT]]></title><description><![CDATA[<p>Bei all den verwirrenden Variablennamen kann ich unmöglich den Fehler finden, geschweige denn zu verstehen, was da genau passiert. Als Erstes solltest du deine Variablen irgendwie sinnvoller benennen. Schau mal, auf welche du verzichten könntest, und schmeiß sie raus. Deklariere die Variablen kurz vor dem Gebrauch (musst natürlich den Sichtbarkeitsbereich beachten) - das wird einige Zeilen einsparen. Rücke bitte den Code ordentlich ein (normalerweise kann man das mit jedem anständigen Compiler automatisch machen). Dann schauen wir mal weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138420</guid><dc:creator><![CDATA[*Rewind*]]></dc:creator><pubDate>Mon, 31 Oct 2011 19:54:34 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 20:20:42 GMT]]></title><description><![CDATA[<p>In diesen Größenordnungen benutzt man eher die Normalverteilung als gute Annäherung an die Binomialverteilung. Wenn du dennoch die Binomialverteilung benutzen willst (und ich würde nicht drauf wetten, dass du hierdurch genauere Ergebnisse bekommst), würde ich Fakultäten logarithmisch berechnen, d. h. n * (n-1) * ... * (n-k+1) = exp(log(n) + log(n-1) + ... + log(n-k+1)).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138424</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138424</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Mon, 31 Oct 2011 20:20:42 GMT</pubDate></item><item><title><![CDATA[Reply to addiert nicht on Mon, 31 Oct 2011 23:58:37 GMT]]></title><description><![CDATA[<p>Und in cmath gibt es std::pow().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138532</guid><dc:creator><![CDATA[bmario_]]></dc:creator><pubDate>Mon, 31 Oct 2011 23:58:37 GMT</pubDate></item></channel></rss>