I have a file full of lines in this format:
1 - 2: 3
I want to only load numbers using C++ streams. Whats the most elegant way to do it? I
I would recommend doing at least cursory sanity checks when reading this:
int a, b, c; char dash, colon; if (not (cin >> a >> dash >> b >> colon >> c) or dash != '-' or colon != ':') Failure. Do something.