using c++ is there any way to cout<<"plz help"<<endl; // only when the space bar is press not enter

some thing like

char userIn;

   cout<<"whatever message"<<endl;

isspace() comes from cstdlib or ccctype to early in the morning for remembering just google it and it will confirm

if you want it event driven then you will need something like a message loop in which you check the keyDown event for the space bar and print then.

hope this helps

All user input is terminated by pressing the ENTER key. Users expect this.

If you want to get individual key presses, you must do an OS-specific thing: disable buffered input.

On Windows, use SetConsoleMode().
On POSIX, use tcsetattr().

Be sure that you only do this when the user expects it, and that you restore things to line-buffered input before your program terminates.

All this is a bit more complicated than you may think. The NCurses library is a good, cross-platform system for writing programs that do this kind of thing.

Getting Started:

Good luck!