#include<conio.h>
#include<stdio.h>
#include<string.h>

  int mistakes_ctr=0;

  int x=52, y=22, i;

  void printM(){
    gotoxy(20,20);
    cprintf("m");

  }

void printP(){

  gotoxy(22,20);
  cprintf("p");

}

void printL(){
  gotoxy(24,20);
  cprintf("l");

  gotoxy(34,20);
  cprintf("l");
}

void printA(){
  gotoxy(26,20);
  cprintf("a");
}

void printN(){
  gotoxy(28,20);
  cprintf("n");
}

void printT(){
  gotoxy(30,20);
  cprintf("t");
}

void printO(){
  gotoxy(32,20);
  cprintf("o");

  gotoxy(36,20);
  cprintf("o");
}

void printG(){
  gotoxy(38,20);
  cprintf("g");
}

void printE(){
  gotoxy(42,20);
  cprintf("e");
}


void game(){
  do{
     textcolor(GREEN);
     gotoxy(15,22);
     cprintf("Type the letter: ");
     scanf("%c", &letter);

     if(letter == 'm'){
       printM();
     }
     if(letter == 'p'){
       printP();
     }
     if(letter == 'l'){
       printL();
     }
     if(letter == 'a'){
       printA();
     }

     if(letter == 'n'){
       printN();
     }

     if(letter == 't'){
       printT();
     }

     if(letter == 'o'){
       printO();
     }

     if(letter == 'l'){
       printL();
     }

     if(letter == 'g'){
       printG();
     }

     if(letter == 'e'){
       printE();
     }
    if((letter != 'm') && (letter != 'p') && (letter != 'l') &&
       (letter != 'a') && (letter != 'n') && (letter != 't') &&
       (letter != 'o') && (letter != 'g') && (letter != 'e')){

      mistakes_ctr++;

      gotoxy(35,22);
      printf("Wrong tries: ");

      gotoxy(++x,22);
      printf("%c", letter);
      printf("Contor: %d",mistakes_ctr);
      }
    }while(mistakes_ctr != 5);
}





void main(){

  clrscr();
  textcolor(LIGHTRED);
  gotoxy(18,20);
  cprintf("I");

  gotoxy(20,20);
  cprintf("_");

  gotoxy(22,20);
  cprintf("_");

  gotoxy(24,20);
  cprintf("_");

  gotoxy(26,20);
  cprintf("_");

  gotoxy(28,20);
  cprintf("_");

  gotoxy(30,20);
  cprintf("_");

  gotoxy(32,20);
  cprintf("_");

  gotoxy(34,20);
  cprintf("_");

  gotoxy(36,20);
  cprintf("_");

  gotoxy(38,20);
  cprintf("_");

  gotoxy(40,20);
  cprintf("I");

  gotoxy(42,20);
  cprintf("_");

  game();
  getch();
}

The enter key is a character too, yet you don't account for it.

Ok...so I added the

    &&(letter != '\n')

Great! Thanks! Haven't write in C for 2 years.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.