I have been a C programmer (NOT C++) for a long time now; and I don't understand why the following code doesn't work.
For some reason, the getch() function runs before anything; and it doesn't stop there. There are other functions that are similiar, like delay()'s etc. This problem only occurs when the code is written in C++, NOT C.Code:#include "iostream.h" #include "conio.h" // getch() int main() { cout << "Why wasn't this printed before the getch()??"; getch(); return 0; }
For instance; This works fine.
I think... I used to know what the problem was; Its probably something small thats overlooked.Code:#include "iostream.h" #include "conio.h" // getch() int main() { printf("Press any key"); getch(); return 0; }
[ Compiler: MSVC++ OS: XP ]