|
|
back to boardgetche function 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 Posted by LiSu 7 Oct 2012 16:20 because getch() and not getche() Re: getche function Is it true? |
|
|