ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1197. Lonesome Knight

Show all messages Hide all messages

getche function alirezaARSH 8 Jul 2012 03:06
why getche is undefined for compiler.in 'dev c 'i used it and is define
program:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int i,j,k,s,b,n;
    char a,c[99][8][8];
    scanf("%d",&n);
    for(k=0;k<n;k++){
                     a=getche();
                     scanf("%d",&b);
                     c[k][(int)a-96][b]='n';
                    }

    for(k=0;k<n;k++){
                     s=0;
                     for(i=1;i<=8;i++)
                     for(j=1;j<=8;j++) {

                                       if(c[k][i][j]=='n'){
                                                        if(i+2<=8&&j+1<=8)     s++;
                                                        if(i+2<=8&&j-1>=1)    s++;
                                                        if(i-1>=1&&j+2<=8)    s++;
                                                        if(i-1>=1&&j-2>=1)   s++;
                                                        if(i-2>=1&&j-1>=1)   s++;
                                                        if(i-2>=1&&j+1<=8)    s++;
                                                        if(i+1<=8&&j-2>=1)    s++;
                                                        if(i+1<=8&&j+2<=8)     s++;
                                                        }
                                     }
                     printf("\n%d",s);
                     }

  system("PAUSE");
  return 0;
}
Re: getche function LiSu 7 Oct 2012 16:20
because getch() and not getche()
Re: getche function bekmyrat 4 Nov 2012 17:27
Is it true?