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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -