How to ignore Enter key when giving input in C in linux without external libraries? -


the program print '*' in xy cordinate , when user input "d" should move 1 spade right.

#include<stdio.h> void draw(int x,int y) { int i,j; if(x==0 && y==0) {     printf("point @ origin");  } else { for(i=1;i<=y;i++)     printf("\n"); for(j=1;j<=x;j++)     printf(" "); printf("*");  } }   int main() { int x,y; char a='a'; printf("eneter x coordinate : "); scanf("%d", &x); printf("eneter y coordinate : "); scanf("%d", &y);  while(1) {    printf("\033[h\033[j");                     //clear screen scanf("%c",&a);  draw(x,y); scanf("%c",&a); if(a=='d' || a=='d') {     x++; } }      return 0; } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -