I'm a Java programmer starting out with C++. I'm reading input from a text file with each line in the form of a date like "12/03/1990". I need to validate the month in the range of 01-12. In Java I would do this:
Is there a class in C++ that can parse a string for numbers?Code:String s = "12/03/1990";
String ss = "";
for (int i=0;i<2;i++) {
ss += s.charAt(i);
}
int n = Integer.parseInt(ss);
boolean x = (n >= 1 || n <= 12) ? true : false;