Skipped input operation in Turbo C
Note: This code is only for Turbo C (Borland C++ version) The following program consists of a loop running 4 times; each iteration takes input via getch() function and stores it in variable c_char of type char; finally printing of "Iteration complete!" marks the end of each iteration. #include <iostream.h> #include <conio.h> void main() { char c; for(int i=0 ; i<4 ; i++) { c=getch(); cout<<"Iteration complete!"; } } On executing it in Turbo C when we press an 'arrow key', the program skips taking input in next iteration. So basically for each arriw key press, "Iteration complete!" is printed twice while on pressing any other character it is printed only once. Please let me know if anyone has a possible explanation for this.