I have a program that checks two inputs for integer values and it works fine but the code I have now is rather long. If I needed to check for 20 entries, is there anyway I could make the checking for a valid integer process into a function? Here is my code:
// Returns true if the string "checkInteger" can be parsed as an integer in the range
// [ std::numeric_limits<int>::min() .. std::numeric_limits<int>::max() ].
bool is_integer( const std::string& checkInteger ) {
// Lines 21-23 here, with slight modification
}