Consider the following program. Why is it that when the statement gets(str) is executed, the character pressed earlier automatically appears on the screen? Furthermore, is there a way to prevent this?
Compiler:Borland C++ 5.5Code:#include<stdio.h> #include<iostream.h> #include<conio.h> int main() { char str[50],choice; choice=char(getch()); cout<<choice<<endl; gets(str); getch(); return(0); }