<?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[Permutationen problem]]></title><description><![CDATA[<p>Hi Leute ich bin neu im Forum,</p>
<p>ich habe eine Probelm.<br />
Ich habe ein Programm geschrieben, der der die Permutationen von drei Zahlen ausrechnen kann.<br />
Bei einem Punkt habe ich einen Problem, immmer, wenn er was gerechnet hat, soll er das Ergebnis abspeichern, dasskrieg ich irgendwie nicht hin.</p>
<p>Hier ist der code:</p>
<pre><code>// next_permutation
#include &lt;iostream&gt;
#include &lt;algorithm&gt;
using namespace std;

int main () {

     int myints[] = {1,2,3};
     float array[50];

  cout &lt;&lt; &quot;The 3! possible permutations with 3 elements:\n&quot;;

  sort (myints,myints+3);

  do {

    cout &lt;&lt; myints[0] &lt;&lt; &quot; &quot; &lt;&lt; myints[1] &lt;&lt; &quot; &quot; &lt;&lt; myints[2] &lt;&lt; endl&lt;&lt; endl;

     int a = myints[0];
     int b = myints[1];
     int c = myints[2];

     float K = 0;
     float H = 0;
     float I = 0;

     if (a == 1)
     {
          K = 0.2;   
     }

    if (a == 2)
    {
          K = 0.3;    
    }

    if (a ==3)
    {
           K = 0.26; 
    }

    if (a == 1 &amp;&amp; b == 2 )
    {
           H = 0.3;
    }

    if (a == 1 &amp;&amp; b == 3)
    {
          H = 0.26;
    }

    if (a == 2 &amp;&amp; b == 1)
    {
          H = 0.26;
    }

    if (a == 2 &amp;&amp; b == 3)
    {
          H = 0.3;
    }

    if (a == 3 &amp;&amp; b == 1)
    {
          H = 0.3;
    }

    if (a == 3 &amp;&amp; b == 2)
    {
          H = 0.26;
    }

    if (b == 1 &amp;&amp; c == 2)
    {
          I = 0.3;
    }

    if (b == 1 &amp;&amp; c == 3)
    {
          I = 0.26;
    } 

    if (b == 2 &amp;&amp; c == 1)
    {
          I = 0.26;
    }

    if (b == 2 &amp;&amp; c == 3)
    {
          I = 0.3;
    }

    if (b == 3 &amp;&amp; c == 1)
    {
          I = 0.3;
    }

    if (b == 3 &amp;&amp; c == 2)
    {
          I = 0.26;
    } 

    float i = 0;

  i = K*H*I ;

  cout&lt;&lt;  i &lt;&lt; endl &lt;&lt; endl;

  } while ( next_permutation (myints,myints+3) );

  system(&quot;PAUSE&quot;);
  return 0;
}
</code></pre>
<p>Also er sollte jedes mal, wenn er i = K*H*I ausgrechnet hat, sie speichern, aber dass funktioniert nicht richtig, denn am ende sollte die Summe der Ganzen Ergebnisse ausgerechnet werden.</p>
<p>Danke voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/300508/permutationen-problem</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 19:27:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/300508.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Mar 2012 16:49:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Permutationen problem on Sun, 04 Mar 2012 16:49:55 GMT]]></title><description><![CDATA[<p>Hi Leute ich bin neu im Forum,</p>
<p>ich habe eine Probelm.<br />
Ich habe ein Programm geschrieben, der der die Permutationen von drei Zahlen ausrechnen kann.<br />
Bei einem Punkt habe ich einen Problem, immmer, wenn er was gerechnet hat, soll er das Ergebnis abspeichern, dasskrieg ich irgendwie nicht hin.</p>
<p>Hier ist der code:</p>
<pre><code>// next_permutation
#include &lt;iostream&gt;
#include &lt;algorithm&gt;
using namespace std;

int main () {

     int myints[] = {1,2,3};
     float array[50];

  cout &lt;&lt; &quot;The 3! possible permutations with 3 elements:\n&quot;;

  sort (myints,myints+3);

  do {

    cout &lt;&lt; myints[0] &lt;&lt; &quot; &quot; &lt;&lt; myints[1] &lt;&lt; &quot; &quot; &lt;&lt; myints[2] &lt;&lt; endl&lt;&lt; endl;

     int a = myints[0];
     int b = myints[1];
     int c = myints[2];

     float K = 0;
     float H = 0;
     float I = 0;

     if (a == 1)
     {
          K = 0.2;   
     }

    if (a == 2)
    {
          K = 0.3;    
    }

    if (a ==3)
    {
           K = 0.26; 
    }

    if (a == 1 &amp;&amp; b == 2 )
    {
           H = 0.3;
    }

    if (a == 1 &amp;&amp; b == 3)
    {
          H = 0.26;
    }

    if (a == 2 &amp;&amp; b == 1)
    {
          H = 0.26;
    }

    if (a == 2 &amp;&amp; b == 3)
    {
          H = 0.3;
    }

    if (a == 3 &amp;&amp; b == 1)
    {
          H = 0.3;
    }

    if (a == 3 &amp;&amp; b == 2)
    {
          H = 0.26;
    }

    if (b == 1 &amp;&amp; c == 2)
    {
          I = 0.3;
    }

    if (b == 1 &amp;&amp; c == 3)
    {
          I = 0.26;
    } 

    if (b == 2 &amp;&amp; c == 1)
    {
          I = 0.26;
    }

    if (b == 2 &amp;&amp; c == 3)
    {
          I = 0.3;
    }

    if (b == 3 &amp;&amp; c == 1)
    {
          I = 0.3;
    }

    if (b == 3 &amp;&amp; c == 2)
    {
          I = 0.26;
    } 

    float i = 0;

  i = K*H*I ;

  cout&lt;&lt;  i &lt;&lt; endl &lt;&lt; endl;

  } while ( next_permutation (myints,myints+3) );

  system(&quot;PAUSE&quot;);
  return 0;
}
</code></pre>
<p>Also er sollte jedes mal, wenn er i = K*H*I ausgrechnet hat, sie speichern, aber dass funktioniert nicht richtig, denn am ende sollte die Summe der Ganzen Ergebnisse ausgerechnet werden.</p>
<p>Danke voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2188396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2188396</guid><dc:creator><![CDATA[darwi]]></dc:creator><pubDate>Sun, 04 Mar 2012 16:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to Permutationen problem on Sun, 04 Mar 2012 17:51:30 GMT]]></title><description><![CDATA[<p>ich würd nen vector nehmen, wenn ich dich richtig verstanden hab</p>
<pre><code class="language-cpp">#include &lt;vector&gt;
...
int main()
{
  vector&lt;float&gt; my_floats;

  while(...)
  {
    ...
    my_floats.push_back(i); // i in vector hinzufügen
  }

  for (auto i = my_floats.begin(); i &lt; my_floats.end(); ++i) // werte ausgeben. statt auto vielleicht vector&lt;float&gt;::const_iterator schreiben, wenn du noch kein c++0x hast/benutzt/es nicht weiß wie man es einstellt/ ... :D
     cout &lt;&lt; *i &lt;&lt; endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2188415</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2188415</guid><dc:creator><![CDATA[vario-500]]></dc:creator><pubDate>Sun, 04 Mar 2012 17:51:30 GMT</pubDate></item></channel></rss>