<?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[Programm gibt nur begrenzt Ergebnisse aus]]></title><description><![CDATA[<p>Hi!<br />
Habe ein Programm geschrieben, dass erstmal nur zufällige Sudokus anzeigen lassen soll. Von oben links nach unten rechts zieht sich eine kette von 3 zufällig erstellten würfeln.<br />
Funktioniert nach einem komplexen Prinzip.Zuerst sollte es nur den b-würfel berechnen, um die rechenweise zu checken.<br />
es zeigt aber bei dem b-würfel nur b1,b2,b4 und b5 an. Ich hab alles zwei und dreifach überprüft, finde den fehler aber einfach nicht.<br />
Könnte mir vielleicht einer nen Tipp geben? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
p.s.:Ja, ich könnte auch backtracking verwenden, aber hier ist es eben anders.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;

using namespace std;

int Random(int n)
{
return rand() % n ;
}

int main(){
int p,q;
int feld[9][9];

srand(time(0));

int w1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w1, w1 + 9, Random);

int a1=w1[0];
int a2=w1[1];
int a3=w1[2];
int a4=w1[3];
int a5=w1[4];
int a6=w1[5];
int a7=w1[6];
int a8=w1[7];
int a9=w1[8];

////////////////////////////////////
////////////////////////////////////

int w5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w5, w5 + 9,Random);

int e1=w5[0];
int e2=w5[1];
int e3=w5[2];
int e4=w5[3];
int e5=w5[4];
int e6=w5[5];
int e7=w5[6];
int e8=w5[7];
int e9=w5[8];

///////////////////////////////////
///////////////////////////////////

int w9[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w9, w9 + 9,Random);

int i1=w9[0];
int i2=w9[1];
int i3=w9[2];
int i4=w9[3];
int i5=w9[4];
int i6=w9[5];
int i7=w9[6];
int i8=w9[7];
int i9=w9[8];

int b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,b8=0,b9=0;
int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0;
int d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0,d9=0;
int f1=0,f2=0,f3=0,f4=0,f5=0,f6=0,f7=0,f8=0,f9=0;
int g1=0,g2=0,g3=0,g4=0,g5=0,g6=0,g7=0,g8=0,g9=0;
int h1=0,h2=0,h3=0,h4=0,h5=0,h6=0,h7=0,h8=0,h9=0;

for(int t=1;t&lt;9;t++)
{

if(a1!=t&amp;&amp;a2!=t&amp;&amp;a3!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b1==0)b1=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b2==0)b2=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b3==0)b3=t;
}}

else if(a4!=t&amp;&amp;a5!=t&amp;&amp;a6!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b4==0)b4=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b5==0)b5=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b6==0)b6=t;
}}

else if(a7!=t&amp;&amp;a8!=t&amp;&amp;a9!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b7==0)b7=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b8==0)b8=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b9==0)b9=t;
}}}

cout&lt;&lt;a1&lt;&lt;&quot; &quot;&lt;&lt;a2&lt;&lt;&quot; &quot;&lt;&lt;a3&lt;&lt;&quot;  &quot;&lt;&lt;b1&lt;&lt;&quot; &quot;&lt;&lt;b2&lt;&lt;&quot; &quot;&lt;&lt;b3&lt;&lt;&quot;  &quot;&lt;&lt;c1&lt;&lt;&quot; &quot;&lt;&lt;c2&lt;&lt;&quot; &quot;&lt;&lt;c3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;a4&lt;&lt;&quot; &quot;&lt;&lt;a5&lt;&lt;&quot; &quot;&lt;&lt;a6&lt;&lt;&quot;  &quot;&lt;&lt;b4&lt;&lt;&quot; &quot;&lt;&lt;b5&lt;&lt;&quot; &quot;&lt;&lt;b6&lt;&lt;&quot;  &quot;&lt;&lt;c4&lt;&lt;&quot; &quot;&lt;&lt;c5&lt;&lt;&quot; &quot;&lt;&lt;c6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;a7&lt;&lt;&quot; &quot;&lt;&lt;a8&lt;&lt;&quot; &quot;&lt;&lt;a9&lt;&lt;&quot;  &quot;&lt;&lt;b7&lt;&lt;&quot; &quot;&lt;&lt;b8&lt;&lt;&quot; &quot;&lt;&lt;b9&lt;&lt;&quot;  &quot;&lt;&lt;c7&lt;&lt;&quot; &quot;&lt;&lt;c8&lt;&lt;&quot; &quot;&lt;&lt;c9&lt;&lt;&quot;\n\n&quot;;

cout&lt;&lt;d1&lt;&lt;&quot; &quot;&lt;&lt;d2&lt;&lt;&quot; &quot;&lt;&lt;d3&lt;&lt;&quot;  &quot;&lt;&lt;e1&lt;&lt;&quot; &quot;&lt;&lt;e2&lt;&lt;&quot; &quot;&lt;&lt;e3&lt;&lt;&quot;  &quot;&lt;&lt;f1&lt;&lt;&quot; &quot;&lt;&lt;f2&lt;&lt;&quot; &quot;&lt;&lt;f3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;d4&lt;&lt;&quot; &quot;&lt;&lt;d5&lt;&lt;&quot; &quot;&lt;&lt;d6&lt;&lt;&quot;  &quot;&lt;&lt;e4&lt;&lt;&quot; &quot;&lt;&lt;e5&lt;&lt;&quot; &quot;&lt;&lt;e6&lt;&lt;&quot;  &quot;&lt;&lt;f4&lt;&lt;&quot; &quot;&lt;&lt;f5&lt;&lt;&quot; &quot;&lt;&lt;f6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;d7&lt;&lt;&quot; &quot;&lt;&lt;d8&lt;&lt;&quot; &quot;&lt;&lt;d9&lt;&lt;&quot;  &quot;&lt;&lt;e7&lt;&lt;&quot; &quot;&lt;&lt;e8&lt;&lt;&quot; &quot;&lt;&lt;e9&lt;&lt;&quot;  &quot;&lt;&lt;f7&lt;&lt;&quot; &quot;&lt;&lt;f8&lt;&lt;&quot; &quot;&lt;&lt;f9&lt;&lt;&quot;\n\n&quot;;

cout&lt;&lt;g1&lt;&lt;&quot; &quot;&lt;&lt;g2&lt;&lt;&quot; &quot;&lt;&lt;g3&lt;&lt;&quot;  &quot;&lt;&lt;h1&lt;&lt;&quot; &quot;&lt;&lt;h2&lt;&lt;&quot; &quot;&lt;&lt;h3&lt;&lt;&quot;  &quot;&lt;&lt;i1&lt;&lt;&quot; &quot;&lt;&lt;i2&lt;&lt;&quot; &quot;&lt;&lt;i3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;g4&lt;&lt;&quot; &quot;&lt;&lt;g5&lt;&lt;&quot; &quot;&lt;&lt;g6&lt;&lt;&quot;  &quot;&lt;&lt;h4&lt;&lt;&quot; &quot;&lt;&lt;h5&lt;&lt;&quot; &quot;&lt;&lt;h6&lt;&lt;&quot;  &quot;&lt;&lt;i4&lt;&lt;&quot; &quot;&lt;&lt;i5&lt;&lt;&quot; &quot;&lt;&lt;i6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;g7&lt;&lt;&quot; &quot;&lt;&lt;g8&lt;&lt;&quot; &quot;&lt;&lt;g9&lt;&lt;&quot;  &quot;&lt;&lt;h7&lt;&lt;&quot; &quot;&lt;&lt;h8&lt;&lt;&quot; &quot;&lt;&lt;h9&lt;&lt;&quot;  &quot;&lt;&lt;i7&lt;&lt;&quot; &quot;&lt;&lt;i8&lt;&lt;&quot; &quot;&lt;&lt;i9&lt;&lt;&quot;\n\n&quot;;

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/286678/programm-gibt-nur-begrenzt-ergebnisse-aus</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 20:32:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/286678.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 May 2011 11:58:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Programm gibt nur begrenzt Ergebnisse aus on Sat, 14 May 2011 11:58:46 GMT]]></title><description><![CDATA[<p>Hi!<br />
Habe ein Programm geschrieben, dass erstmal nur zufällige Sudokus anzeigen lassen soll. Von oben links nach unten rechts zieht sich eine kette von 3 zufällig erstellten würfeln.<br />
Funktioniert nach einem komplexen Prinzip.Zuerst sollte es nur den b-würfel berechnen, um die rechenweise zu checken.<br />
es zeigt aber bei dem b-würfel nur b1,b2,b4 und b5 an. Ich hab alles zwei und dreifach überprüft, finde den fehler aber einfach nicht.<br />
Könnte mir vielleicht einer nen Tipp geben? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
p.s.:Ja, ich könnte auch backtracking verwenden, aber hier ist es eben anders.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;

using namespace std;

int Random(int n)
{
return rand() % n ;
}

int main(){
int p,q;
int feld[9][9];

srand(time(0));

int w1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w1, w1 + 9, Random);

int a1=w1[0];
int a2=w1[1];
int a3=w1[2];
int a4=w1[3];
int a5=w1[4];
int a6=w1[5];
int a7=w1[6];
int a8=w1[7];
int a9=w1[8];

////////////////////////////////////
////////////////////////////////////

int w5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w5, w5 + 9,Random);

int e1=w5[0];
int e2=w5[1];
int e3=w5[2];
int e4=w5[3];
int e5=w5[4];
int e6=w5[5];
int e7=w5[6];
int e8=w5[7];
int e9=w5[8];

///////////////////////////////////
///////////////////////////////////

int w9[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

random_shuffle(w9, w9 + 9,Random);

int i1=w9[0];
int i2=w9[1];
int i3=w9[2];
int i4=w9[3];
int i5=w9[4];
int i6=w9[5];
int i7=w9[6];
int i8=w9[7];
int i9=w9[8];

int b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,b8=0,b9=0;
int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0;
int d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0,d9=0;
int f1=0,f2=0,f3=0,f4=0,f5=0,f6=0,f7=0,f8=0,f9=0;
int g1=0,g2=0,g3=0,g4=0,g5=0,g6=0,g7=0,g8=0,g9=0;
int h1=0,h2=0,h3=0,h4=0,h5=0,h6=0,h7=0,h8=0,h9=0;

for(int t=1;t&lt;9;t++)
{

if(a1!=t&amp;&amp;a2!=t&amp;&amp;a3!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b1==0)b1=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b2==0)b2=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b3==0)b3=t;
}}

else if(a4!=t&amp;&amp;a5!=t&amp;&amp;a6!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b4==0)b4=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b5==0)b5=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b6==0)b6=t;
}}

else if(a7!=t&amp;&amp;a8!=t&amp;&amp;a9!=t)
{
if(e1!=t&amp;&amp;e4!=t&amp;&amp;e7!=t)
{
if(b7==0)b7=t;
}
else if(e2!=t&amp;&amp;e5!=t&amp;&amp;e8!=t)
{
if(b8==0)b8=t;
}
else if(e3!=t&amp;&amp;e6!=t&amp;&amp;e9!=t)
{
if(b9==0)b9=t;
}}}

cout&lt;&lt;a1&lt;&lt;&quot; &quot;&lt;&lt;a2&lt;&lt;&quot; &quot;&lt;&lt;a3&lt;&lt;&quot;  &quot;&lt;&lt;b1&lt;&lt;&quot; &quot;&lt;&lt;b2&lt;&lt;&quot; &quot;&lt;&lt;b3&lt;&lt;&quot;  &quot;&lt;&lt;c1&lt;&lt;&quot; &quot;&lt;&lt;c2&lt;&lt;&quot; &quot;&lt;&lt;c3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;a4&lt;&lt;&quot; &quot;&lt;&lt;a5&lt;&lt;&quot; &quot;&lt;&lt;a6&lt;&lt;&quot;  &quot;&lt;&lt;b4&lt;&lt;&quot; &quot;&lt;&lt;b5&lt;&lt;&quot; &quot;&lt;&lt;b6&lt;&lt;&quot;  &quot;&lt;&lt;c4&lt;&lt;&quot; &quot;&lt;&lt;c5&lt;&lt;&quot; &quot;&lt;&lt;c6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;a7&lt;&lt;&quot; &quot;&lt;&lt;a8&lt;&lt;&quot; &quot;&lt;&lt;a9&lt;&lt;&quot;  &quot;&lt;&lt;b7&lt;&lt;&quot; &quot;&lt;&lt;b8&lt;&lt;&quot; &quot;&lt;&lt;b9&lt;&lt;&quot;  &quot;&lt;&lt;c7&lt;&lt;&quot; &quot;&lt;&lt;c8&lt;&lt;&quot; &quot;&lt;&lt;c9&lt;&lt;&quot;\n\n&quot;;

cout&lt;&lt;d1&lt;&lt;&quot; &quot;&lt;&lt;d2&lt;&lt;&quot; &quot;&lt;&lt;d3&lt;&lt;&quot;  &quot;&lt;&lt;e1&lt;&lt;&quot; &quot;&lt;&lt;e2&lt;&lt;&quot; &quot;&lt;&lt;e3&lt;&lt;&quot;  &quot;&lt;&lt;f1&lt;&lt;&quot; &quot;&lt;&lt;f2&lt;&lt;&quot; &quot;&lt;&lt;f3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;d4&lt;&lt;&quot; &quot;&lt;&lt;d5&lt;&lt;&quot; &quot;&lt;&lt;d6&lt;&lt;&quot;  &quot;&lt;&lt;e4&lt;&lt;&quot; &quot;&lt;&lt;e5&lt;&lt;&quot; &quot;&lt;&lt;e6&lt;&lt;&quot;  &quot;&lt;&lt;f4&lt;&lt;&quot; &quot;&lt;&lt;f5&lt;&lt;&quot; &quot;&lt;&lt;f6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;d7&lt;&lt;&quot; &quot;&lt;&lt;d8&lt;&lt;&quot; &quot;&lt;&lt;d9&lt;&lt;&quot;  &quot;&lt;&lt;e7&lt;&lt;&quot; &quot;&lt;&lt;e8&lt;&lt;&quot; &quot;&lt;&lt;e9&lt;&lt;&quot;  &quot;&lt;&lt;f7&lt;&lt;&quot; &quot;&lt;&lt;f8&lt;&lt;&quot; &quot;&lt;&lt;f9&lt;&lt;&quot;\n\n&quot;;

cout&lt;&lt;g1&lt;&lt;&quot; &quot;&lt;&lt;g2&lt;&lt;&quot; &quot;&lt;&lt;g3&lt;&lt;&quot;  &quot;&lt;&lt;h1&lt;&lt;&quot; &quot;&lt;&lt;h2&lt;&lt;&quot; &quot;&lt;&lt;h3&lt;&lt;&quot;  &quot;&lt;&lt;i1&lt;&lt;&quot; &quot;&lt;&lt;i2&lt;&lt;&quot; &quot;&lt;&lt;i3&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;g4&lt;&lt;&quot; &quot;&lt;&lt;g5&lt;&lt;&quot; &quot;&lt;&lt;g6&lt;&lt;&quot;  &quot;&lt;&lt;h4&lt;&lt;&quot; &quot;&lt;&lt;h5&lt;&lt;&quot; &quot;&lt;&lt;h6&lt;&lt;&quot;  &quot;&lt;&lt;i4&lt;&lt;&quot; &quot;&lt;&lt;i5&lt;&lt;&quot; &quot;&lt;&lt;i6&lt;&lt;&quot;\n&quot;;

cout&lt;&lt;g7&lt;&lt;&quot; &quot;&lt;&lt;g8&lt;&lt;&quot; &quot;&lt;&lt;g9&lt;&lt;&quot;  &quot;&lt;&lt;h7&lt;&lt;&quot; &quot;&lt;&lt;h8&lt;&lt;&quot; &quot;&lt;&lt;h9&lt;&lt;&quot;  &quot;&lt;&lt;i7&lt;&lt;&quot; &quot;&lt;&lt;i8&lt;&lt;&quot; &quot;&lt;&lt;i9&lt;&lt;&quot;\n\n&quot;;

return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2063243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2063243</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 14 May 2011 11:58:46 GMT</pubDate></item><item><title><![CDATA[Reply to Programm gibt nur begrenzt Ergebnisse aus on Sat, 14 May 2011 12:52:36 GMT]]></title><description><![CDATA[<p>Was soll denn das mit diesen tausenden Variablen a1,a2,a3 etc? Du hast doch schon Arrays gefunden und kannst dir die Arbeit vermutlich erleichtern, indem du anstelle dieses Variablenhaufens ein (evt. mehrdimensionales) Array verwendest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2063254</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2063254</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 14 May 2011 12:52:36 GMT</pubDate></item><item><title><![CDATA[Reply to Programm gibt nur begrenzt Ergebnisse aus on Sat, 14 May 2011 13:10:04 GMT]]></title><description><![CDATA[<p>Und wenn du schon dabei bist: Ein paar Leerzeichen tun einem Quelltext auch ganz gut.<br />
Beispiel</p>
<pre><code class="language-cpp">if(a1!=t&amp;&amp;a2!=t&amp;&amp;a3!=t)
</code></pre>
<p>Das liest sich noch nicht einmal jemand durch, weil es einfach nur aussieht wie hingekotzt.</p>
<pre><code class="language-cpp">if(a1 != t &amp;&amp; a2 != t &amp;&amp; a3 != t)
</code></pre>
<p>Schon viel besser. Vielleicht sollte man noch die logische Struktur deutlich machen. So:</p>
<pre><code class="language-cpp">if((a1 != t) &amp;&amp; (a2 != t) &amp;&amp; (a3 != t))
</code></pre>
<p>Oder auch so:</p>
<pre><code class="language-cpp">if (a1 != t 
 &amp;&amp; a2 != t 
 &amp;&amp; a3 != t)
</code></pre>
<p>Das kann ein einigermaßen erfahrener Programmierer sogar querlesen, so dass eine Chance besteht, dass sich jemand einen Quelltext der nur aus if-Abfragen besteht tatsächlich durchliest. Und dabei Fehler möglicherweise sogar auf den ersten Blick sieht.</p>
<p>P.S.: Bedauerlicherweise hast du keinen einzigen der Tipps aus den anderen Threads umgesetzt, wie du besseren Code schreiben könntest. Nicht einmal Arrays hast du dir angeguckt - du benutzt sie, ohne sie zu verstehen. Viele Leute haben keine Lust zu helfen, wenn sie wissen, dass sie ignoriert werden.</p>
<p>Außerdem kann man sich das formatieren natürlich auch automatisieren lassen, wenn man extrem schreibfaul ist:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
#include &lt;algorithm&gt;

using namespace std;

int
Random (int n)
{
  return rand () % n;
}

int
main ()
{
  int p, q;
  int feld[9][9];

  srand (time (0));

  int w1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

  random_shuffle (w1, w1 + 9, Random);

  int a1 = w1[0];
  int a2 = w1[1];
  int a3 = w1[2];
  int a4 = w1[3];
  int a5 = w1[4];
  int a6 = w1[5];
  int a7 = w1[6];
  int a8 = w1[7];
  int a9 = w1[8];

////////////////////////////////////
////////////////////////////////////

  int w5[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

  random_shuffle (w5, w5 + 9, Random);

  int e1 = w5[0];
  int e2 = w5[1];
  int e3 = w5[2];
  int e4 = w5[3];
  int e5 = w5[4];
  int e6 = w5[5];
  int e7 = w5[6];
  int e8 = w5[7];
  int e9 = w5[8];

///////////////////////////////////
///////////////////////////////////

  int w9[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

  random_shuffle (w9, w9 + 9, Random);

  int i1 = w9[0];
  int i2 = w9[1];
  int i3 = w9[2];
  int i4 = w9[3];
  int i5 = w9[4];
  int i6 = w9[5];
  int i7 = w9[6];
  int i8 = w9[7];
  int i9 = w9[8];

  int b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0, b8 = 0, b9 = 0;
  int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0, c8 = 0, c9 = 0;
  int d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0, d9 = 0;
  int f1 = 0, f2 = 0, f3 = 0, f4 = 0, f5 = 0, f6 = 0, f7 = 0, f8 = 0, f9 = 0;
  int g1 = 0, g2 = 0, g3 = 0, g4 = 0, g5 = 0, g6 = 0, g7 = 0, g8 = 0, g9 = 0;
  int h1 = 0, h2 = 0, h3 = 0, h4 = 0, h5 = 0, h6 = 0, h7 = 0, h8 = 0, h9 = 0;

  for (int t = 1; t &lt; 9; t++)
    {

      if (a1 != t &amp;&amp; a2 != t &amp;&amp; a3 != t)
        {
          if (e1 != t &amp;&amp; e4 != t &amp;&amp; e7 != t)
            {
              if (b1 == 0)
                b1 = t;
            }
          else if (e2 != t &amp;&amp; e5 != t &amp;&amp; e8 != t)
            {
              if (b2 == 0)
                b2 = t;
            }
          else if (e3 != t &amp;&amp; e6 != t &amp;&amp; e9 != t)
            {
              if (b3 == 0)
                b3 = t;
            }
        }

      else if (a4 != t &amp;&amp; a5 != t &amp;&amp; a6 != t)
        {
          if (e1 != t &amp;&amp; e4 != t &amp;&amp; e7 != t)
            {
              if (b4 == 0)
                b4 = t;
            }
          else if (e2 != t &amp;&amp; e5 != t &amp;&amp; e8 != t)
            {
              if (b5 == 0)
                b5 = t;
            }
          else if (e3 != t &amp;&amp; e6 != t &amp;&amp; e9 != t)
            {
              if (b6 == 0)
                b6 = t;
            }
        }

      else if (a7 != t &amp;&amp; a8 != t &amp;&amp; a9 != t)
        {
          if (e1 != t &amp;&amp; e4 != t &amp;&amp; e7 != t)
            {
              if (b7 == 0)
                b7 = t;
            }
          else if (e2 != t &amp;&amp; e5 != t &amp;&amp; e8 != t)
            {
              if (b8 == 0)
                b8 = t;
            }
          else if (e3 != t &amp;&amp; e6 != t &amp;&amp; e9 != t)
            {
              if (b9 == 0)
                b9 = t;
            }
        }
    }

  cout &lt;&lt; a1 &lt;&lt; &quot; &quot; &lt;&lt; a2 &lt;&lt; &quot; &quot; &lt;&lt; a3 &lt;&lt; &quot;  &quot; &lt;&lt; b1 &lt;&lt; &quot; &quot; &lt;&lt; b2 &lt;&lt; &quot; &quot; &lt;&lt; b3
    &lt;&lt; &quot;  &quot; &lt;&lt; c1 &lt;&lt; &quot; &quot; &lt;&lt; c2 &lt;&lt; &quot; &quot; &lt;&lt; c3 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; a4 &lt;&lt; &quot; &quot; &lt;&lt; a5 &lt;&lt; &quot; &quot; &lt;&lt; a6 &lt;&lt; &quot;  &quot; &lt;&lt; b4 &lt;&lt; &quot; &quot; &lt;&lt; b5 &lt;&lt; &quot; &quot; &lt;&lt; b6
    &lt;&lt; &quot;  &quot; &lt;&lt; c4 &lt;&lt; &quot; &quot; &lt;&lt; c5 &lt;&lt; &quot; &quot; &lt;&lt; c6 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; a7 &lt;&lt; &quot; &quot; &lt;&lt; a8 &lt;&lt; &quot; &quot; &lt;&lt; a9 &lt;&lt; &quot;  &quot; &lt;&lt; b7 &lt;&lt; &quot; &quot; &lt;&lt; b8 &lt;&lt; &quot; &quot; &lt;&lt; b9
    &lt;&lt; &quot;  &quot; &lt;&lt; c7 &lt;&lt; &quot; &quot; &lt;&lt; c8 &lt;&lt; &quot; &quot; &lt;&lt; c9 &lt;&lt; &quot;\n\n&quot;;

  cout &lt;&lt; d1 &lt;&lt; &quot; &quot; &lt;&lt; d2 &lt;&lt; &quot; &quot; &lt;&lt; d3 &lt;&lt; &quot;  &quot; &lt;&lt; e1 &lt;&lt; &quot; &quot; &lt;&lt; e2 &lt;&lt; &quot; &quot; &lt;&lt; e3
    &lt;&lt; &quot;  &quot; &lt;&lt; f1 &lt;&lt; &quot; &quot; &lt;&lt; f2 &lt;&lt; &quot; &quot; &lt;&lt; f3 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; d4 &lt;&lt; &quot; &quot; &lt;&lt; d5 &lt;&lt; &quot; &quot; &lt;&lt; d6 &lt;&lt; &quot;  &quot; &lt;&lt; e4 &lt;&lt; &quot; &quot; &lt;&lt; e5 &lt;&lt; &quot; &quot; &lt;&lt; e6
    &lt;&lt; &quot;  &quot; &lt;&lt; f4 &lt;&lt; &quot; &quot; &lt;&lt; f5 &lt;&lt; &quot; &quot; &lt;&lt; f6 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; d7 &lt;&lt; &quot; &quot; &lt;&lt; d8 &lt;&lt; &quot; &quot; &lt;&lt; d9 &lt;&lt; &quot;  &quot; &lt;&lt; e7 &lt;&lt; &quot; &quot; &lt;&lt; e8 &lt;&lt; &quot; &quot; &lt;&lt; e9
    &lt;&lt; &quot;  &quot; &lt;&lt; f7 &lt;&lt; &quot; &quot; &lt;&lt; f8 &lt;&lt; &quot; &quot; &lt;&lt; f9 &lt;&lt; &quot;\n\n&quot;;

  cout &lt;&lt; g1 &lt;&lt; &quot; &quot; &lt;&lt; g2 &lt;&lt; &quot; &quot; &lt;&lt; g3 &lt;&lt; &quot;  &quot; &lt;&lt; h1 &lt;&lt; &quot; &quot; &lt;&lt; h2 &lt;&lt; &quot; &quot; &lt;&lt; h3
    &lt;&lt; &quot;  &quot; &lt;&lt; i1 &lt;&lt; &quot; &quot; &lt;&lt; i2 &lt;&lt; &quot; &quot; &lt;&lt; i3 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; g4 &lt;&lt; &quot; &quot; &lt;&lt; g5 &lt;&lt; &quot; &quot; &lt;&lt; g6 &lt;&lt; &quot;  &quot; &lt;&lt; h4 &lt;&lt; &quot; &quot; &lt;&lt; h5 &lt;&lt; &quot; &quot; &lt;&lt; h6
    &lt;&lt; &quot;  &quot; &lt;&lt; i4 &lt;&lt; &quot; &quot; &lt;&lt; i5 &lt;&lt; &quot; &quot; &lt;&lt; i6 &lt;&lt; &quot;\n&quot;;

  cout &lt;&lt; g7 &lt;&lt; &quot; &quot; &lt;&lt; g8 &lt;&lt; &quot; &quot; &lt;&lt; g9 &lt;&lt; &quot;  &quot; &lt;&lt; h7 &lt;&lt; &quot; &quot; &lt;&lt; h8 &lt;&lt; &quot; &quot; &lt;&lt; h9
    &lt;&lt; &quot;  &quot; &lt;&lt; i7 &lt;&lt; &quot; &quot; &lt;&lt; i8 &lt;&lt; &quot; &quot; &lt;&lt; i9 &lt;&lt; &quot;\n\n&quot;;

  return 0;
}
</code></pre>
<p>Bamm! Mit einem Schlag von unlesbar zu strukturiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2063259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2063259</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 14 May 2011 13:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to Programm gibt nur begrenzt Ergebnisse aus on Sat, 14 May 2011 13:12:07 GMT]]></title><description><![CDATA[<p>@sjepp: doch , natürlich hab ich mir arrays angesehen.<br />
das hier anzuwenden geht nur mit einem md-array wie eben</p>
<pre><code class="language-cpp">int feld[9][9];
</code></pre>
<p>ich hab versucht es da reinzubringen, hab aber nicht sofort verstanden wie.<br />
solange hab ich es anders versucht.</p>
<p>und ja, sorry, ich habs vergessen vor dem posten die konstruktionen anschaulicher zu machen, werde es gleich editieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2063268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2063268</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 14 May 2011 13:12:07 GMT</pubDate></item><item><title><![CDATA[Reply to Programm gibt nur begrenzt Ergebnisse aus on Sat, 14 May 2011 13:14:36 GMT]]></title><description><![CDATA[<p>ahh, hast du ja schon gemacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2063270</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2063270</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 14 May 2011 13:14:36 GMT</pubDate></item></channel></rss>