in c++ when user press enter or press space i want to do defferent orders.for example when user press enter it prints "you press enter" and when press space it prints "you press space".i think it should be like this code :
As far as I know, when you use std::cin, the program waits for the user to enter a character, so if you just press enter without typing anything in, it will continue to wait for the user's input.