hey guys,
i am working on a code..code runs fine however there is lot of input on the screen thus i am using a pause function to freeze the screen till user hits enter key. however function always skips the first time and works fine after that. i used cin.clear() but it still not clearing the old input steram. Again it only happens the first time.. after the first time it works fine. thanks for all the help

void pressEnter()
{
cin.clear(); // check for junk in the stream
cout << "\nPress Enter for more results";

//cin.ignore(); i tried this as well but same result
cin.get();
}

clear() does nothing to the input steam. Here is how to delete everything up to '\n' from the input stream.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.