<?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[Suche Rechenformel]]></title><description><![CDATA[<p>Hallo<br />
ich möchte für ein Spiel ein berechnungs Programm machen.</p>
<p>Als nach einem Sieg bekommt der Spieler 1 Punkt nach 2 Siegen 2 Punkte und nach 3 Siegen 4 Punkte ....</p>
<p>Sieg 1 = Punkt 1</p>
<p>Siege 2 = Punkte2</p>
<p>Siege 3 = Punkte 4</p>
<p>Siege 4 = Punkte 6</p>
<p>Siege 5 = Punkte 8</p>
<p>Siege 6 = Punkte12</p>
<p>Siege = Punkte 16</p>
<p>Aber ich weiss nicht wie ich das als eine Formel oder so machen kann hat da wer eine idee ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194723/suche-rechenformel</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 17:00:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194723.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Oct 2007 09:30:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 09:30:02 GMT]]></title><description><![CDATA[<p>Hallo<br />
ich möchte für ein Spiel ein berechnungs Programm machen.</p>
<p>Als nach einem Sieg bekommt der Spieler 1 Punkt nach 2 Siegen 2 Punkte und nach 3 Siegen 4 Punkte ....</p>
<p>Sieg 1 = Punkt 1</p>
<p>Siege 2 = Punkte2</p>
<p>Siege 3 = Punkte 4</p>
<p>Siege 4 = Punkte 6</p>
<p>Siege 5 = Punkte 8</p>
<p>Siege 6 = Punkte12</p>
<p>Siege = Punkte 16</p>
<p>Aber ich weiss nicht wie ich das als eine Formel oder so machen kann hat da wer eine idee ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381859</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Wed, 10 Oct 2007 09:30:02 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 09:38:32 GMT]]></title><description><![CDATA[<p>Steckt da irgendein System dahinter? Wenn ja, solltest du das vielleicht erklären. Sonst ist nicht sichergestellt, dass eine Formel, auch wenn sie auf diese Werte passt, so weitergeht, wie du dir das vorgestellt hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381866</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 10 Oct 2007 09:38:32 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 09:59:52 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int CalculateWinPoints (int iWins)
{
    if (iWins == 1)
        return 1;
    else if (iWins != 0)
        return (iWins - 1) * 2;
}
</code></pre>
<p>Vorausgesetzt, es werden pro Sieg immer nur 2 Punkte hinzugefügt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381886</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Wed, 10 Oct 2007 09:59:52 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:05:22 GMT]]></title><description><![CDATA[<p>Wenns nicht lang (bzw. nicht endlos) und hartcodiert sein soll, kannste einfach einen vector (oder auch ein simples Array) benutzen:</p>
<pre><code class="language-cpp">const int punkteliste[MAX_SIEGE] = {0, 1, 2, 4, 8, 12, 16, /*...*/};

int main() {
  int gesiegt = wie_oft_hab_ich_gewonnen();
  int punkte = punkteliste[gesiegt];
  cout &lt;&lt; &quot;Du hast &quot; &lt;&lt; gesiegt &lt;&lt; &quot; mal gewonnen und dafuer &quot; &lt;&lt; punkte &lt;&lt; &quot;&quot; Punkte bekommen!&quot; &lt;&lt; endl;
  ich_bin_fertig();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1381888</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381888</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:05:22 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:15:03 GMT]]></title><description><![CDATA[<p>BitWax schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int CalculateWinPoints (int iWins)
{
    if (iWins == 1)
        return 1;
    else if (iWins != 0)
        return (iWins - 1) * 2;
}
</code></pre>
</blockquote>
<pre><code class="language-cpp">std::cout &lt;&lt; CalculateWinPoints(0);
</code></pre>
<p>ausgabe schrieb:</p>
<blockquote>
<ol start="42">
<li></li>
</ol>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1381895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381895</guid><dc:creator><![CDATA[omfg, squirrels!]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:15:03 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:18:40 GMT]]></title><description><![CDATA[<p>wenn du immer das doppelte nehmen würdest wäre das leichter...</p>
<pre><code class="language-cpp">#include &lt;cmath&gt;

int calcScore(int intWins)
{
    return pow(2, (intWins - 1));
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1381898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381898</guid><dc:creator><![CDATA[Basingstoke]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:18:40 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:21:43 GMT]]></title><description><![CDATA[<p>@BitWax: Deine Lösung passt schon für 6 Siege nicht mehr zu den Vorgaben <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>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16770">@Bassmaster</a>: Das fehlt eine zusammenhängende Formel - und aus dem Anfang kann man sehr viel ableiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381900</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381900</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:21:43 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:22:14 GMT]]></title><description><![CDATA[<p>BitWax schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int CalculateWinPoints (int iWins)
{
    if (iWins == 1)
        return 1;
    else if (iWins != 0)
        return (iWins - 1) * 2;
}
</code></pre>
<p>Vorausgesetzt, es werden pro Sieg immer nur 2 Punkte hinzugefügt.</p>
</blockquote>
<p>normalerweise sollte er das nicht kompilieren da nicht alle<br />
Wege zum return führen!Oder?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381902</guid><dc:creator><![CDATA[Basingstoke]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 10:24:01 GMT]]></title><description><![CDATA[<p>Basingstoke schrieb:</p>
<blockquote>
<p>Normalerweise sollte er das nicht kompilieren da nicht alle Wege zum return führen!Oder?!</p>
</blockquote>
<p>Doch, das ist nur undefiniertes Verhalten zur Laufzeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381905</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:24:01 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:10:26 GMT]]></title><description><![CDATA[<p>Naja, habe nicht Richtung hingeguckt bei der Beschreibung :p<br />
Habe das relativ schnell hingeklatscht und auch nicht getestet...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381943</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381943</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:10:26 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:11:21 GMT]]></title><description><![CDATA[<p>BitWax schrieb:</p>
<blockquote>
<p>Naja, habe nicht Richtung hingeguckt bei der Beschreibung :p<br />
Habe das relativ schnell hingeklatscht und auch nicht getestet...</p>
</blockquote>
<p>Dann hättest du dir die Antwort auch sparen können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381945</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:11:21 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:13:30 GMT]]></title><description><![CDATA[<p>Ja, entschuldige das ich helfen wollte und es ein falscher Lösungsweg war.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381949</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381949</guid><dc:creator><![CDATA[Fake oder Echt]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:13:30 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:24:56 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int calc(int Sieg){

 if(Sieg==1)
   return 1;
 return (Sieg%5)*(((Sieg/5)+1) *2);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1381956</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381956</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:24:56 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:32:41 GMT]]></title><description><![CDATA[<p>Bassmaster schrieb:</p>
<blockquote>
<p>Hallo<br />
ich möchte für ein Spiel ein berechnungs Programm machen.</p>
<p>Als nach einem Sieg bekommt der Spieler 1 Punkt nach 2 Siegen 2 Punkte und nach 3 Siegen 4 Punkte ....</p>
</blockquote>
<p>Also die Folge 1,2,4,6,8,12,16,.. usw.<br />
Folgender Code</p>
<pre><code class="language-cpp">set&lt; int &gt; punkte;
    for( int k = 10; k &lt;= 1000; k *= 10 )
        for( int j = 1; ; (j *= 2) %= k )
            if( !punkte.insert( j ).second &amp;&amp; j &gt; k/10 )
                break;
</code></pre>
<p>erzeugt die Folge:</p>
<blockquote>
<p>1 2 4 6 8 12 16 24 28 32 36 44 48 52 56 64 68 72 76 84 88 92 96 104 112 128 136<br />
144 152 168 176 184 192 208 216 224 232 248 256 264 272 288 296 304 312 328 336<br />
344 352 368 376 384 392 408 416 424 432 448 456 464 472 488 496 504 512 528 536<br />
544 552 568 576 584 592 608 616 624 632 648 656 664 672 688 696 704 712 728 736<br />
744 752 768 776 784 792 808 816 824 832 848 856 864 872 888 896 904 912 928 936<br />
944 952 968 976 984 992</p>
</blockquote>
<p>.. das war doch offensichtlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /> - oder nicht?</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381965</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381965</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 11:52:16 GMT]]></title><description><![CDATA[<p>Sry meine Tabelle stimmte nicht ganz^^<br />
Hier ist die richtige:</p>
<p>Siege in Folge<br />
1 1 Fame<br />
2 2<br />
3 3<br />
4 4<br />
5 6<br />
6 8<br />
7 12<br />
8 16<br />
9 20<br />
10 24<br />
11 28<br />
12 32<br />
13 36<br />
14 40<br />
jeder weitere Sieg 40 Fame</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381981</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Wed, 10 Oct 2007 11:52:16 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 12:02:14 GMT]]></title><description><![CDATA[<p>Werner Salomon kannste plz den Kompletten Source Code schicken ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381987</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Wed, 10 Oct 2007 12:02:14 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 12:04:12 GMT]]></title><description><![CDATA[<p>Bassmaster schrieb:</p>
<blockquote>
<p>jeder weitere Sieg 40 Fame</p>
</blockquote>
<p>Das geht doch noch:</p>
<pre><code class="language-cpp">int frame(int sieg)
{
  int score[]={1,2,3,4,6,8,12,16,20,24,28,32,36};
  return (sieg&gt;=14)?40:score[sieg-1];
}
</code></pre>
<p>Alternativ kann man das auch als abschnittsweise Funktion definieren:</p>
<pre><code class="language-cpp">int frame(int sieg)
{
  if(sieg&lt;=4)
    return sieg;
  else if(sieg&lt;=5)
    return sieg+1;
  else if(sieg&lt;=14)
    return 4*(sieg-4);
  else
    return 40;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1381991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381991</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 10 Oct 2007 12:04:12 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 12:10:11 GMT]]></title><description><![CDATA[<p>Musst du als Moderator immer alles so schnell verraten, lass doch die anderen auch mal antworten. <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/1381997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381997</guid><dc:creator><![CDATA[@CStoll]]></dc:creator><pubDate>Wed, 10 Oct 2007 12:10:11 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 12:12:12 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/10318">@CStoll</a> schrieb:</p>
<blockquote>
<p>Musst du als Moderator immer alles so schnell verraten, lass doch die anderen auch mal antworten. <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>
</blockquote>
<p>Erstens lasse ich mir von anonymen **** nichts sagen - und zweitens habe ich nunmal die Angewohnheit, auf vernünftig klingende Fragen zu antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382000</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382000</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 10 Oct 2007 12:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 12:20:48 GMT]]></title><description><![CDATA[<p>Mit dir machen diese Ratespiele einfach keinen Spass. :p</p>
<p>mfg<br />
anonymer star</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382013</guid><dc:creator><![CDATA[@CStoll]]></dc:creator><pubDate>Wed, 10 Oct 2007 12:20:48 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Wed, 10 Oct 2007 20:36:08 GMT]]></title><description><![CDATA[<p>Bassmaster schrieb:</p>
<blockquote>
<p>Werner Salomon kannste plz den Kompletten Source Code schicken ?</p>
</blockquote>
<p>hier ist er:</p>
<pre><code class="language-cpp">#include &lt;algorithm&gt;    // copy
#include &lt;iostream&gt;     // cout, endl
#include &lt;iterator&gt;     // ostream_iterator
#include &lt;set&gt;          // set

int main()
{
    using namespace std;
    set&lt; int &gt; punkte;
    // --   erzeugt die Folge 1,2,4,6,8,12,16,...
    //      Zahlen der Form 2^j (mod 10^k), wobei j und k positive ganze Zahlen sind
    //      Bem.: hier enspricht k := 10^k und j := 2^j bzw. 2^j mod 10^k
    for( int k = 10; k &lt;= 1000; k *= 10 )
        for( int j = 1; ; (j *= 2) %= k )
            if( !punkte.insert( j ).second &amp;&amp; j &gt; k/10 )
                break;
    copy( punkte.begin(), punkte.end(), ostream_iterator&lt; int &gt;( cout, &quot; &quot; ) );
    cout &lt;&lt; endl;
    return 0;
}
</code></pre>
<p>siehe auch <a href="http://www.research.att.com/~njas/sequences/?q=1%2c2%2c4%2c6%2c8%2c12%2c16&amp;p=2&amp;n=10" rel="nofollow">hier</a>.</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382406</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Wed, 10 Oct 2007 20:36:08 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Thu, 11 Oct 2007 06:26:01 GMT]]></title><description><![CDATA[<p>hey, schlaue seite!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382535</guid><dc:creator><![CDATA[Basingstoke]]></dc:creator><pubDate>Thu, 11 Oct 2007 06:26:01 GMT</pubDate></item><item><title><![CDATA[Reply to Suche Rechenformel on Thu, 11 Oct 2007 07:43:50 GMT]]></title><description><![CDATA[<p>Ok thx Werner <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382572</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382572</guid><dc:creator><![CDATA[Bassmaster]]></dc:creator><pubDate>Thu, 11 Oct 2007 07:43:50 GMT</pubDate></item></channel></rss>