+ 2
What does cin.clear() do? Does it just destroy all user input or...what?
2 Respuestas
+ 2
I guess you could get a better undestanding of the function if you go to a IDE like VSCode and get the function definition to see exactly what it does, that being said, you can check the link below and see a brief explanation on stackoverflow.
https://stackoverflow.com/questions/1525535/delete-all-items-from-a-c-stdvector
+ 2
clear(), with no argument provided, simply resets the state of the flags failbit, eofbit and badbit, by assigning them the value of goodbit. These are used to check for errors encountered during operations.
Here is a detailed reference: www.cplusplus.com/reference/ios/basic_ios/clear
en.cppreference.com/w/cpp/header/io/basic_ios/clear