Problems with Getch() program execution order
I'm having problems with the getch() function. The following program executes like this:
(type in "napKIN" then <enter>)
(output)napKINHow do I make this appear before the input?
I want it to say the text, then output the input.
Here is my code:
Code:
#include <conio.h>
#include <iostream.h>
char text;
int main()
{
cout<<"How do I make this appear before the input?";
while ((text=getch()) != '\r')
cout<<text;
cout<<"\n"<<text;
return 0;
}
Could someone please tell me how to do this, please?
napKIN