why cout not works before getche() in VC++ 6.0?

Viewed 18

I want to show a message before an input :

cout<<"Enter a char:";
ch = getche();

But when running program it does not show the message and getche() works and after that the message is showed !!!

The whole program :

#include <iostream.h>
#include <conio.h>

int main(){
    int ch;
    cout<<"Enter a char:";
    //cin.ignore();
    ch = getche();

    return 0;
}

The whole problem that, i want to do is this:

1- show a message 
2- enter ONLY one char 
3- do something immediately after entering the char
1 Answers

Adding endl soleved the problem :

cout<<"Enter a char:"<<endl;
ch = getche();
Related