<?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[4-Gewinnt Schleifen-Problem]]></title><description><![CDATA[<p>Hi</p>
<p>Ich habe versucht 4 Gewinnt zu programmieren. Bis jetzt habe ich die Oberfläche<br />
und die Möglichkeit geschaffen ein X oder eine 0 zu setzen</p>
<p>Mein Problem ist eigentlich simpel:</p>
<p>Ich habe versucht dashier zu einer for-schleife zu machen</p>
<pre><code>gotoxy(xn[1],yn[1]);
 if (z[1] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  } 
 gotoxy(xn[2],yn[2]);
 if (z[2] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[3],yn[3]);
</code></pre>
<p>das sah dan so aus:</p>
<pre><code>for (i=1;i&gt;=28;i++)
 {
  gotoxy(xn[i],yn[i]);
  if (z[i] %2==0)
   {                                
     cprintf(&quot;0&quot;);
   }
  else
   {
     cprintf(&quot;X&quot;);
   }
</code></pre>
<p>Das Funktioniert aber nur begrenzt weil ich beim nächsten Tastendruck das eben gesetzte Zeichen nicht mehr habe <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="😞"
    /></p>
<p>ok hier die Klarheit</p>
<pre><code>#include &lt;cstdlib&gt;                                                 //initialisierung
#include &lt;iostream&gt;                                                //initialisierung
#include &lt;conio2.h&gt;                                                //initialisierung
#include &lt;windows.h&gt;                                               //initialisierung                                           
#include &lt;winuser.h&gt;
using namespace std;

void Spielfeld()                                                   //void definieren
  { clrscr();                                                      //löscht Oberfläche
    textcolor(WHITE);                                              //Textfarbe    
    gotoxy(25,2);                                                  //setzt Cursor an Stelle x,y
    cprintf(&quot;4  -  G e w i n n t&quot;);                                //Textausgabe
    gotoxy(1,4);                                                   //setzt Cursor an Stelle x,y
    cprintf(&quot;\n          |___|___|___|___|___|___|___|&quot;   
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |___|___|___|___|___|___|___|&quot;
            &quot;\n          | 1 | 2 | 3 | 4 | 5 | 6 | 7 |&quot;); 

    gotoxy(55,20);
    cprintf(&quot;Ende mit ESC&quot;);                                            
    }         

int x=25;                                                           //Variable definieren
int y=5;                                                            //Variable definieren
char Taste;                                                       //Variable definieren
int abbruch=0;  
int xn[30]={-1};                                                      //xn = x neu
int yn[30]={-1};                                                      //yn = y neu
int z[30];                                                    
int i=1;
int zeichen=1;
int a=1;
int b=2;

                                                    //Variable definieren
int main(int argc, char *argv[])
{

////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////Variable X bewegen////////////////////////////////////////////

   Spielfeld();                                                     //void Definition benutzen

 do                                                                 //Beginn do-while Schleife
  {
  textcolor(LIGHTRED);                                              //Textfarbe                    
  gotoxy(x,y);                                                      //setzt Cursor an Stelle x,y  
   if(kbhit())                                                      //if Funktion
    {
     Taste=getch();                                                 //warte auf Tastendruck

     switch(Taste)                                                  //Beginn switch-Funktion
       {
        case 'a':  clrscr();                                        //löscht Oberfläche
                   Spielfeld();                                     //void Definition benutzen
                   x=x-4;                                             
             break;
        case 'd': clrscr();                                         //löscht Oberfläche
                  Spielfeld();                                      //void Definition benutzen
                  x=x+4;
             break;
        case 's': clrscr();                                         //löscht Oberfläche
                  Spielfeld();                                      //void Definition benutzen
                  y=y+2;
             break;     
        case 27: return EXIT_SUCCESS;                               //Beenden des Programms
             break;     
       }   
/////////////////////////////Spielfeldbegrenzung///////////////////////////////////////////      
    if(y&lt;5) y=5;                                                    //von Bildschirmposition(y-Achse)                        
    else if(y&gt;13) y=13;                                             //bis Bildschormposition(y-Achse)

    if(x&lt;13) x=13;                                                  //von Bildschirmposition(x-Achse)
    else if(x&gt;37) x=37;                                             //bis Bildschormposition(x-Achse)  
/////////////////////////////Positionierung///////////////////////////////////////////   
    if (Taste==13)
    {                   
                   zeichen++;
                   if(zeichen&gt;2)
                    {
                      zeichen=1;
                    }
                   i++;      
   }  
 }
 if (i %2==0)
 {
 gotoxy(x,y);
 cprintf(&quot;X&quot;);
 }
 else
 {
 gotoxy(x,y);
 cprintf(&quot;0&quot;);
 } 
 gotoxy(50,10);
 cprintf(&quot;%i,%i&quot;,x,y);
////////////////////////////////////Übergabebereich//////////////////////////////////
 if(x==13 &amp; y==13 &amp; Taste==13)
 {
    xn[1]=x;
    yn[1]=y;
    z[1]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==13 &amp; Taste==13)
 {
    xn[2]=x;
    yn[2]=y;
    z[2]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==13 &amp; Taste==13)
 {
    xn[3]=x;
    yn[3]=y;
    z[3]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==13 &amp; Taste==13)
 {
    xn[4]=x;
    yn[4]=y;
    z[4]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==13 &amp; Taste==13)
 {
    xn[5]=x;
    yn[5]=y;
    z[5]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==13 &amp; Taste==13)
 {
    xn[6]=x;
    yn[6]=y;
    z[6]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==13 &amp; Taste==13)
 {
    xn[7]=x;
    yn[7]=y;
    z[7]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==11 &amp; Taste==13)
 {
    xn[8]=x;
    yn[8]=y;
    z[8]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==11 &amp; Taste==13)
 {
    xn[9]=x;
    yn[9]=y;
    z[9]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==11 &amp; Taste==13)
 {
    xn[10]=x;
    yn[10]=y;
    z[10]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==11 &amp; Taste==13)
 {
    xn[11]=x;
    yn[11]=y;
    z[11]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==11 &amp; Taste==13)
 {
    xn[12]=x;
    yn[12]=y;
    z[12]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==11 &amp; Taste==13)
 {
    xn[13]=x;
    yn[13]=y;
    z[13]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==11 &amp; Taste==13)
 {
    xn[14]=x;
    yn[14]=y;
    z[14]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==9 &amp; Taste==13)
 {
    xn[15]=x;
    yn[15]=y;
    z[15]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==9 &amp; Taste==13)
 {
    xn[16]=x;
    yn[16]=y;
    z[16]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==9 &amp; Taste==13)
 {
    xn[17]=x;
    yn[17]=y;
    z[17]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==9 &amp; Taste==13)
 {
    xn[18]=x;
    yn[18]=y;
    z[18]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==9 &amp; Taste==13)
 {
    xn[19]=x;
    yn[19]=y;
    z[19]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==9 &amp; Taste==13)
 {
    xn[20]=x;
    yn[20]=y;
    z[20]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==9 &amp; Taste==13)
 {
    xn[21]=x;
    yn[21]=y;
    z[21]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==7 &amp; Taste==13)
 {
    xn[22]=x;
    yn[22]=y;
    z[22]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==7 &amp; Taste==13)
 {
    xn[23]=x;
    yn[23]=y;
    z[23]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==7 &amp; Taste==13)
 {
    xn[24]=x;
    yn[24]=y;
    z[24]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==7 &amp; Taste==13)
 {
    xn[25]=x;
    yn[25]=y;
    z[25]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==7 &amp; Taste==13)
 {
    xn[26]=x;
    yn[26]=y;
    z[26]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==7 &amp; Taste==13)
 {
    xn[27]=x;
    yn[27]=y;
    z[27]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==7 &amp; Taste==13)
 {
    xn[28]=x;
    yn[28]=y;
    z[28]=zeichen;
    x=25;
    y=5;
 }
/* for (i=1;i&gt;=28;i++)
 {
  gotoxy(xn[i],yn[i]);
  if (z[i] %2==0)
   {                                Funktioniert leider nicht sonst könnte ich 
     cprintf(&quot;0&quot;);                  mir alles hier drunter sparen
   }
  else
   {
     cprintf(&quot;X&quot;);
   } 
 }*/
 gotoxy(xn[1],yn[1]);
 if (z[1] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  } 
 gotoxy(xn[2],yn[2]);
 if (z[2] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[3],yn[3]);
 if (z[3] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[4],yn[4]);
 if (z[4] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[5],yn[5]);
 if (z[5] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[6],yn[6]);
 if (z[6] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[7],yn[7]);
 if (z[7] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[8],yn[8]);
 if (z[8] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[9],yn[9]);
 if (z[9] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[10],yn[10]);
 if (z[10] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[11],yn[11]);
 if (z[11] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[12],yn[12]);
 if (z[12] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[13],yn[13]);
 if (z[13] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[14],yn[14]);
 if (z[14] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[15],yn[15]);
 if (z[15] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[16],yn[16]);
 if (z[16] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[17],yn[17]);
 if (z[17] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[18],yn[18]);
 if (z[18] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[19],yn[19]);
 if (z[19] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[20],yn[20]);
 if (z[20] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[21],yn[21]);
 if (z[20] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[22],yn[22]);
 if (z[22] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[23],yn[23]);
 if (z[23] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[24],yn[24]);
 if (z[24] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }

 gotoxy(xn[25],yn[25]);
 if (z[25] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[26],yn[26]);
 if (z[26] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[27],yn[27]);
 if (z[27] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[28],yn[28]);
 if (z[28] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
} while(!abbruch);                                               //Ende do-while Schleife 

    getch();                                                        //warte auf Tastendruck
    return EXIT_SUCCESS;                                            //Ende des Programms
}
</code></pre>
<p>Ich würde mich sehr freuen wenn mir jemand bei den Schleifen helfen könnte</p>
<p>mfg<br />
Megawurrrm</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/301945/4-gewinnt-schleifen-problem</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 15:23:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/301945.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 Apr 2012 17:11:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 4-Gewinnt Schleifen-Problem on Sat, 07 Apr 2012 17:11:52 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Ich habe versucht 4 Gewinnt zu programmieren. Bis jetzt habe ich die Oberfläche<br />
und die Möglichkeit geschaffen ein X oder eine 0 zu setzen</p>
<p>Mein Problem ist eigentlich simpel:</p>
<p>Ich habe versucht dashier zu einer for-schleife zu machen</p>
<pre><code>gotoxy(xn[1],yn[1]);
 if (z[1] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  } 
 gotoxy(xn[2],yn[2]);
 if (z[2] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[3],yn[3]);
</code></pre>
<p>das sah dan so aus:</p>
<pre><code>for (i=1;i&gt;=28;i++)
 {
  gotoxy(xn[i],yn[i]);
  if (z[i] %2==0)
   {                                
     cprintf(&quot;0&quot;);
   }
  else
   {
     cprintf(&quot;X&quot;);
   }
</code></pre>
<p>Das Funktioniert aber nur begrenzt weil ich beim nächsten Tastendruck das eben gesetzte Zeichen nicht mehr habe <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="😞"
    /></p>
<p>ok hier die Klarheit</p>
<pre><code>#include &lt;cstdlib&gt;                                                 //initialisierung
#include &lt;iostream&gt;                                                //initialisierung
#include &lt;conio2.h&gt;                                                //initialisierung
#include &lt;windows.h&gt;                                               //initialisierung                                           
#include &lt;winuser.h&gt;
using namespace std;

void Spielfeld()                                                   //void definieren
  { clrscr();                                                      //löscht Oberfläche
    textcolor(WHITE);                                              //Textfarbe    
    gotoxy(25,2);                                                  //setzt Cursor an Stelle x,y
    cprintf(&quot;4  -  G e w i n n t&quot;);                                //Textausgabe
    gotoxy(1,4);                                                   //setzt Cursor an Stelle x,y
    cprintf(&quot;\n          |___|___|___|___|___|___|___|&quot;   
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |   |   |   |   |   |   |   |&quot;
            &quot;\n          |___|___|___|___|___|___|___|&quot;
            &quot;\n          | 1 | 2 | 3 | 4 | 5 | 6 | 7 |&quot;); 

    gotoxy(55,20);
    cprintf(&quot;Ende mit ESC&quot;);                                            
    }         

int x=25;                                                           //Variable definieren
int y=5;                                                            //Variable definieren
char Taste;                                                       //Variable definieren
int abbruch=0;  
int xn[30]={-1};                                                      //xn = x neu
int yn[30]={-1};                                                      //yn = y neu
int z[30];                                                    
int i=1;
int zeichen=1;
int a=1;
int b=2;

                                                    //Variable definieren
int main(int argc, char *argv[])
{

////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////Variable X bewegen////////////////////////////////////////////

   Spielfeld();                                                     //void Definition benutzen

 do                                                                 //Beginn do-while Schleife
  {
  textcolor(LIGHTRED);                                              //Textfarbe                    
  gotoxy(x,y);                                                      //setzt Cursor an Stelle x,y  
   if(kbhit())                                                      //if Funktion
    {
     Taste=getch();                                                 //warte auf Tastendruck

     switch(Taste)                                                  //Beginn switch-Funktion
       {
        case 'a':  clrscr();                                        //löscht Oberfläche
                   Spielfeld();                                     //void Definition benutzen
                   x=x-4;                                             
             break;
        case 'd': clrscr();                                         //löscht Oberfläche
                  Spielfeld();                                      //void Definition benutzen
                  x=x+4;
             break;
        case 's': clrscr();                                         //löscht Oberfläche
                  Spielfeld();                                      //void Definition benutzen
                  y=y+2;
             break;     
        case 27: return EXIT_SUCCESS;                               //Beenden des Programms
             break;     
       }   
/////////////////////////////Spielfeldbegrenzung///////////////////////////////////////////      
    if(y&lt;5) y=5;                                                    //von Bildschirmposition(y-Achse)                        
    else if(y&gt;13) y=13;                                             //bis Bildschormposition(y-Achse)

    if(x&lt;13) x=13;                                                  //von Bildschirmposition(x-Achse)
    else if(x&gt;37) x=37;                                             //bis Bildschormposition(x-Achse)  
/////////////////////////////Positionierung///////////////////////////////////////////   
    if (Taste==13)
    {                   
                   zeichen++;
                   if(zeichen&gt;2)
                    {
                      zeichen=1;
                    }
                   i++;      
   }  
 }
 if (i %2==0)
 {
 gotoxy(x,y);
 cprintf(&quot;X&quot;);
 }
 else
 {
 gotoxy(x,y);
 cprintf(&quot;0&quot;);
 } 
 gotoxy(50,10);
 cprintf(&quot;%i,%i&quot;,x,y);
////////////////////////////////////Übergabebereich//////////////////////////////////
 if(x==13 &amp; y==13 &amp; Taste==13)
 {
    xn[1]=x;
    yn[1]=y;
    z[1]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==13 &amp; Taste==13)
 {
    xn[2]=x;
    yn[2]=y;
    z[2]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==13 &amp; Taste==13)
 {
    xn[3]=x;
    yn[3]=y;
    z[3]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==13 &amp; Taste==13)
 {
    xn[4]=x;
    yn[4]=y;
    z[4]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==13 &amp; Taste==13)
 {
    xn[5]=x;
    yn[5]=y;
    z[5]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==13 &amp; Taste==13)
 {
    xn[6]=x;
    yn[6]=y;
    z[6]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==13 &amp; Taste==13)
 {
    xn[7]=x;
    yn[7]=y;
    z[7]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==11 &amp; Taste==13)
 {
    xn[8]=x;
    yn[8]=y;
    z[8]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==11 &amp; Taste==13)
 {
    xn[9]=x;
    yn[9]=y;
    z[9]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==11 &amp; Taste==13)
 {
    xn[10]=x;
    yn[10]=y;
    z[10]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==11 &amp; Taste==13)
 {
    xn[11]=x;
    yn[11]=y;
    z[11]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==11 &amp; Taste==13)
 {
    xn[12]=x;
    yn[12]=y;
    z[12]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==11 &amp; Taste==13)
 {
    xn[13]=x;
    yn[13]=y;
    z[13]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==11 &amp; Taste==13)
 {
    xn[14]=x;
    yn[14]=y;
    z[14]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==9 &amp; Taste==13)
 {
    xn[15]=x;
    yn[15]=y;
    z[15]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==9 &amp; Taste==13)
 {
    xn[16]=x;
    yn[16]=y;
    z[16]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==9 &amp; Taste==13)
 {
    xn[17]=x;
    yn[17]=y;
    z[17]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==9 &amp; Taste==13)
 {
    xn[18]=x;
    yn[18]=y;
    z[18]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==9 &amp; Taste==13)
 {
    xn[19]=x;
    yn[19]=y;
    z[19]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==9 &amp; Taste==13)
 {
    xn[20]=x;
    yn[20]=y;
    z[20]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==9 &amp; Taste==13)
 {
    xn[21]=x;
    yn[21]=y;
    z[21]=zeichen;
    x=25;
    y=5;
 }
 if(x==13 &amp; y==7 &amp; Taste==13)
 {
    xn[22]=x;
    yn[22]=y;
    z[22]=zeichen;
    x=25;
    y=5;
 }
 if(x==17 &amp; y==7 &amp; Taste==13)
 {
    xn[23]=x;
    yn[23]=y;
    z[23]=zeichen;
    x=25;
    y=5;
 }
 if(x==21 &amp; y==7 &amp; Taste==13)
 {
    xn[24]=x;
    yn[24]=y;
    z[24]=zeichen;
    x=25;
    y=5;
 }
 if(x==25 &amp; y==7 &amp; Taste==13)
 {
    xn[25]=x;
    yn[25]=y;
    z[25]=zeichen;
    x=25;
    y=5;
 }
 if(x==29 &amp; y==7 &amp; Taste==13)
 {
    xn[26]=x;
    yn[26]=y;
    z[26]=zeichen;
    x=25;
    y=5;
 }
 if(x==33 &amp; y==7 &amp; Taste==13)
 {
    xn[27]=x;
    yn[27]=y;
    z[27]=zeichen;
    x=25;
    y=5;
 }
 if(x==37 &amp; y==7 &amp; Taste==13)
 {
    xn[28]=x;
    yn[28]=y;
    z[28]=zeichen;
    x=25;
    y=5;
 }
/* for (i=1;i&gt;=28;i++)
 {
  gotoxy(xn[i],yn[i]);
  if (z[i] %2==0)
   {                                Funktioniert leider nicht sonst könnte ich 
     cprintf(&quot;0&quot;);                  mir alles hier drunter sparen
   }
  else
   {
     cprintf(&quot;X&quot;);
   } 
 }*/
 gotoxy(xn[1],yn[1]);
 if (z[1] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  } 
 gotoxy(xn[2],yn[2]);
 if (z[2] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[3],yn[3]);
 if (z[3] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[4],yn[4]);
 if (z[4] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[5],yn[5]);
 if (z[5] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[6],yn[6]);
 if (z[6] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[7],yn[7]);
 if (z[7] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[8],yn[8]);
 if (z[8] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[9],yn[9]);
 if (z[9] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[10],yn[10]);
 if (z[10] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[11],yn[11]);
 if (z[11] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[12],yn[12]);
 if (z[12] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[13],yn[13]);
 if (z[13] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[14],yn[14]);
 if (z[14] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[15],yn[15]);
 if (z[15] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[16],yn[16]);
 if (z[16] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[17],yn[17]);
 if (z[17] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[18],yn[18]);
 if (z[18] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[19],yn[19]);
 if (z[19] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[20],yn[20]);
 if (z[20] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[21],yn[21]);
 if (z[20] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[22],yn[22]);
 if (z[22] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[23],yn[23]);
 if (z[23] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[24],yn[24]);
 if (z[24] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }

 gotoxy(xn[25],yn[25]);
 if (z[25] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[26],yn[26]);
 if (z[26] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[27],yn[27]);
 if (z[27] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
 gotoxy(xn[28],yn[28]);
 if (z[28] %2==0)
  {
    cprintf(&quot;0&quot;);
  }
 else
  {
    cprintf(&quot;X&quot;);
  }
} while(!abbruch);                                               //Ende do-while Schleife 

    getch();                                                        //warte auf Tastendruck
    return EXIT_SUCCESS;                                            //Ende des Programms
}
</code></pre>
<p>Ich würde mich sehr freuen wenn mir jemand bei den Schleifen helfen könnte</p>
<p>mfg<br />
Megawurrrm</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2199695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2199695</guid><dc:creator><![CDATA[Megawurrrm]]></dc:creator><pubDate>Sat, 07 Apr 2012 17:11:52 GMT</pubDate></item><item><title><![CDATA[Reply to 4-Gewinnt Schleifen-Problem on Sat, 07 Apr 2012 17:29:38 GMT]]></title><description><![CDATA[<p>Megawurrrm schrieb:</p>
<blockquote>
<p>ok hier die Klarheit</p>
</blockquote>
<p>Hä? Welche Klarheit???</p>
<p>Ich versteh deinen Code nicht, ist auch viel zu viel, und ich versteh nicht, was du willst und was nicht geht. Ich seh nur, dass was du geschrieben hast, so keinen Sinn macht. Das ganze &quot;if (x == ... &amp;&amp; y == ... &amp;&amp; taste == )&quot; kann und MUSS man eliminieren. Danach können wir vielleicht weiterreden, wenn sich dein Problem dann bei einem sinnvolleren Aufbau nicht eh von selbst löst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2199705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2199705</guid><dc:creator><![CDATA[Mechanics]]></dc:creator><pubDate>Sat, 07 Apr 2012 17:29:38 GMT</pubDate></item><item><title><![CDATA[Reply to 4-Gewinnt Schleifen-Problem on Sat, 07 Apr 2012 18:10:34 GMT]]></title><description><![CDATA[<p>genau die möchte ich weg haben</p>
<p>Eine idee wie ich daraus ne sinvolle schleife mache?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2199722</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2199722</guid><dc:creator><![CDATA[Megawurrrm]]></dc:creator><pubDate>Sat, 07 Apr 2012 18:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to 4-Gewinnt Schleifen-Problem on Sat, 07 Apr 2012 19:03:54 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">for (i=1;i&lt;=28;i++)
</code></pre>
<p>&lt;= anstatt &gt;= <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/2199745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2199745</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sat, 07 Apr 2012 19:03:54 GMT</pubDate></item><item><title><![CDATA[Reply to 4-Gewinnt Schleifen-Problem on Sat, 07 Apr 2012 19:32:49 GMT]]></title><description><![CDATA[<p>danke sehr <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/2199750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2199750</guid><dc:creator><![CDATA[Megawurrrm]]></dc:creator><pubDate>Sat, 07 Apr 2012 19:32:49 GMT</pubDate></item></channel></rss>