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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -