The first thing i noticed was on line 8. In the if statement, there's an error in the second condition. '\' is an escape character, which means it gives the character immediately following a different meaning. a \ followed by a quotation mark nullifies a quotation mark, so it's picking up the rest of your code as a continuous quote. Change line 8 to this:
if(temp[i] == '-' || temp[i] == '\\')
'\\' evaluates to '\' after the program is built.
Also, you need to encapsulate those in single quotes, because temp[i] is a char type, not a string type.
As for the second part, i'm not too sure what you're trying to accomplish there.
Line 14, i hasn't been defined yet. You defined i in the scope of the for loop, but nowhere else, so the implementation doesn't know what i is.
I would scrap everything after the for loop and take a different approach.
Look into the function sscanf: http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/
An example relating to date format:
string date = "11/20/12";
int month = 0, day = 0, year = 0;
sscanf(date.c_str(), "%i/%i/%i", &month, &day, &year);
cout << Month: " << month << "\nDay: " << day << "\nYear: " << year << endl;
The output of that code would look like:
You could use sscanf to pull month day and year from the string. If any of those values are less than ten, add a zero infront of it when outputting it (to meet your requirements.)
Having the month, day, and year separate, you could also check boundaries. Day can't be less than 1 or greater than 31, month can't be less than 0 or greater than 12.