I am writing a C++ CLI application how can I detect if any key is pressed by the user. I've seen that in c# but how can it be implement in c++
while(1)
     {
      while(/* code to check if any key is pressed*/)
           {        //rest of the code
                    // sleep function
           }
     }
Hint: like in CLI games to move or to take certain action when a key is pressed or don't do any thing if no input is given.