I try to validate the kode inputs by using getche to validate each characters input,after that i ask the name {gets(nama);} instead of receiving input the program passes it.
my codes:
char kode[4];
char nama[20];
void menu()
{
char input;
int i=0;
printf("\n");
gotoxy(1,7);
printf("KODE : ");
do
{ gotoxy(12+i,7); printf(" ");
gotoxy(12+i,7);
input=getche();
if(input==8&&i>0)
i--;
else
if(i<=2&&((input>=48&&input<=57)||(input>=97&&inpu t<=122))) /*validasi per karakter*/
{ kode[i]=input;
i++;
}
} while(input!=13||i!=3);
gotoxy(1,8);
printf("NAMA : ");
do{gotoxy(12,8);clreol();
gotoxy(12,8);fflush(stdin);gets(nama);
}while(strlen(nama)>20);
}