Date input

Nov 18, 2011 at 7:23am
Hey all :)
If i have to input a date, lets say 11/12/08 into separate int's, how do i do that? Please help :o
I tried to get separate 2 char arrays putting a cin.ignore(); but stringstream convert(tmp);
doesn't work for some reason
Last edited on Nov 18, 2011 at 7:24am
Nov 18, 2011 at 7:35am
I don't think I quite understand your question. Do you mean the the user inputs a date, for example 11/12/08 and you would like the program to break this up into 3 different ints one representing the day, one representing the month and one the year?
Nov 18, 2011 at 7:36am
Yes, i want there to be three integers, a = 11, b = 12, c = 08
Nov 18, 2011 at 8:35am
ifstream in("input.txt");
int d[3];
char s;
for(int i = 1; i <=3; i++){
in >> d[i];
in >> s;
}

Solved.
Topic archived. No new replies allowed.