Skip to content

Instantly share code, notes, and snippets.

@muaddib1971
Created April 13, 2023 09:22
Show Gist options
  • Save muaddib1971/5712fc118a3b5a8b274ab9c6d558b72f to your computer and use it in GitHub Desktop.
Save muaddib1971/5712fc118a3b5a8b274ab9c6d558b72f to your computer and use it in GitHub Desktop.
cintest
#include <iostream>
#include <string>
#include <limits>
int main(void) {
int count{};
while(true) {
std::string s;
std::cout << "ctrl-d has been pressed " << count << " times "
<< std::endl;
std::getline(std::cin, s);
if(std::cin.eof()){
++count;
std::cin.clear();
std::cout << std::numeric_limits<std::streamsize>::max() << "\n";
std::cin.ignore(std::numeric_limits<std::streamsize>::max());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment