turboc++ - Unexpected input from turbo c++ emulator using DOSBox -


#include <iostream.h> #include <conio.h>  void main(){     float a,b,c;     clrscr();     cout<<"enter , b ";     cin>>a>>b;     c=a+b;     cout<<a<<"+"<<b<<"="<<c;     getch(); } 

upon running this: screenshot of cmd session

i did digging debugger , input never received.

why happening

my guess there's in keyboard buffer feeds garbage data cin.

try while(kbhit()) getch(); before cin>>a>>b; , let me know if helps.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -