I'm trying to validate a date format on on a line such as this one (01 10 2017) by creating a stream.
if(i%5==4){ //DATE
std::string date;
int day;
int month;
int year;
std::ostringstream oss(date);
oss >> day;
oss >> month;
oss >> year;
if (day >=0 && day <= 31){
return true;}
if (month >=01 && month <= 12){
return true;}
if (year >=1900){
return true;}
}
However, the code doesn't compile. What could I do to improve the validation?
Thank you