C++ help? how to make this wait until key press.?

Follow
  • Follow publicly
  • Follow privately
  • Unfollow
im writing a basic C++ code and it has no errors, but at the end i wrote std::endl; to make it pause for a key stroke, but it wont, is there an answer to this? Im using visual studio ...show more
Best Answer
Where you define variables write
char key;

Then where you have std::cin.get(); change this to:

std::cin >> key;

I believe std::cin.get() is just trying to get the last of the display and not waiting for another keystroke. But by doing this it will wait and display what you have.
  • Rate
  • Comment
Sign In 

to add your answer

No other answers

Who is following this question?

    %
    BEST ANSWERS
    Member Since:
    Points: Points: Level
    Total Answers:
    Points this week:
    Follow
     
    Unfollow
     
    Block
     
    Unblock