How to get C++ to ignore slashes

Bear with me on this question as I am basically brand new to c++. I am trying to write a program in which the user can enter a date in the format "MM/DD/YYYY" and the program will tell the user what day of the year it is. For example, if the user entered 12/31/2015, the program will tell the user it is day 365 of the year. But how would I get c++ to ignore the slashes that the user enters and how can I store the month, day, and year in separate variables since they are all entered in one line? I tried cin.ignore and getline, but had no luck.

Any feedback would be appreciated
You can simply do
1
2
3
4
5
6
7
8
int day;
int month;
int year;

{
    char slash; //temp junk variable for slashes
    std::cin >> month >> slash >> day >> slash >> year;
}


Please keep in mind that leap years could throw this off.
Topic archived. No new replies allowed.