Let us say that we are reading a float with std::cin or from a file, and want to enforce the condition that it has two trailing decimal places:
E.g.
4.01 (valid)
4.001 (invalid - has three trailing decimal places)
a,47 (invalid, has two non [0-9] characters in 'a' and ',')
#556.53 (invalid, has '#')
(Just for context, in my example, I am parsing from a text file with several entries separated by spaces, validating each input, and storing them in a struct for further processing.)
How do we do it?