   Help me with these
  I´m moving a dot around the screan but the problem is that when I press a key and then another, the program repeat the first one twice.E.i. :  K,K,K,H . It does 4 times K and then H...could someone help me... "kb" is a char.player is a struct with xp(X pos), yp(Y pos)  do{   }while(!kbhit());   kb = getch();   do   { do {    switch (kb)    {  case ''H'':  {player.yp-=tile;break;  }  case ''P'':  {player.yp+=tile;break;  }  case ''K'':  {player.xp-=tile;break;  }  case ''M'':  {player.xp+=tile;break;  }    }    kb = getch(); }while(!kbhit()); putpixel(player.xp , player.yp , player.color);   }while(kb!=27);thankxz 
  I''m not sure, but I think this is sort of what you want. I didn''t read everything, so if it isn''t sorry. bool done = false;while (!done) {    if (kbhit()) {    switch(getch()) {    case ''h'' :   // code for h  break;    .    .    .    case EXIT:  // make EXIT some char done = true;    }    } else {    putpixel(   );    }};  thankxz, I can use that, the problem is that it would be putting the pixel all the time... ;  I know why you get the key twice: It's because you have a getch at the begining of your code in the outside of the case while and then you have another one after the while, so the first time you press a key it is catched twice, try this kb = 0;   while(kb!=27)   { while( !kbhit() ) {    kb = getch();switch( kb )    {  case 'H':  {player.yp-=tile;break;  }  case 'P':  {player.yp+=tile;break;  }  case 'K':  {player.xp-=tile;break;  }  case 'M':  {player.xp+=tile;break;  }    }// end case }//end while putpixel(player.xp , player.yp , player.color);   }//end while [edited by - J_Vitel on August 3, 2003 5:08:33 AM];  I notice that you change the cases, i know what u try to do, but the player.xp has to be as I put it above, because I use that varible later on a matrix as index.apart from that the code doesnt work, or I have done something wrong...thankxz anyway   numbloq@yahoo.com 