Skip to content

Instantly share code, notes, and snippets.

View tmplt's full-sized avatar

Viktor Vilhelm Sonesten tmplt

View GitHub Profile
while (!(cin >> x)) {
cout << "error: something went wrong!" // alert user
cin.clear();
cin.ignore(1000, '\n'); // discard non-type (if x is a specific type) value in input buffer
}