Skipped input operation in Turbo C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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.

22nd Jun 2018, 4:14 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
3 Answers
+ 3
don't use turbo c lol
22nd Jun 2018, 6:13 PM
hinanawi
hinanawi - avatar
+ 1
hinanawi I m sorry but if u don't know then u hav no right to throw useless comments.
23rd Jun 2018, 4:25 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 1
Immortal🌼 Thanks you very much
25th Jun 2018, 4:03 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar