Could anyone tell me why this doesn't work please??
Thanks.Code:#include <iostream> #include <conio.h> using namespace std; int main() { do { cout << "Still in the do...while loop" << endl; } while(!kbhit()); return EXIT_SUCCESS; }
Could anyone tell me why this doesn't work please??
Thanks.Code:#include <iostream> #include <conio.h> using namespace std; int main() { do { cout << "Still in the do...while loop" << endl; } while(!kbhit()); return EXIT_SUCCESS; }
How does it not work?
Also, I'm using Dev-C++ if it makes a difference.
It says something like kbhit isn't defined and neither is EXIT_SUCCESS.
Something like that, I don't understand it too much.
Well, you can always add this to the top of your code to take care of the one:
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
kbhit is NOT ANSI C, and as such, the ported Unix compilers won't know it.
I'm not sure how to do a C workaround (I've forgotten a lot of C's i/o, I know how to do a kbhit-like function in C++...)
Ok. My code now is...
Is there an easier way (keeping the code from the first post) or will this do??Code:#include <iostream> #include <stdlib.h> #include <conio_mingw.h> using namespace std; int main() { do { cout << "Still in the do...while loop" << endl; } while(!kbhit()); return EXIT_SUCCESS; }