Question on CIN

Hey guess, sorry for the rookie questions. I'm new to this, I tried a search and really dont even know what I'm looking for, or what this would be called.

I'm trying to make a numerology report, but I'm not looking for complete help.

I just have a simple question reguarding my cin statement.

Heres what I have so far:

int year;
int month;
int year;

cout << "Enter the Birth Date seperated by dashes. (MM-DD-YYYY): "<<endl;

cin >> month >> date >> year;

What I'm trying to do is with a single cin sepereate the MM DD and YYYY.

Is that possible?
[679 byte] By [Flakester] at [2007-11-20 11:42:58]
# 1 Re: Question on CIN
Well have you tried it out?

It will work if you enter the birth date separeted with spaces. Just try it out man :)

Btw: You are redefining "year", I think you forgot the declare date,

Laitinen
laitinen at 2007-11-9 1:26:07 >
# 2 Re: Question on CIN
To do so, the best way will probably to read a string in the flow with a cin.getbuf method.
So, you'll be able to parse manually the string.

For instance,

#include <iostream>
using namespace std;

int main(int , char *[])
{
char buf[256];
cin.getbuf(buf, 255);

int day, month, year;

if(buf[2]!='/' || buf[5]!='/')
cerr << "You should type the date with the following pattern: dd/mm/yyyy" << endl;
else
{
buf[2] = '\0';
buf[5] = '\0';
day = atoi(buf);
month = atoi(buf+3);
year = atoi(buf+6);
}
}

Write this without testing, I hope there's no error.
Oups, this is the french date format.
Kotfeller at 2007-11-9 1:27:03 >
# 3 Re: Question on CIN
Thanks guys, sorry I'm very new to this. I appreciate the help.
Flakester at 2007-11-9 1:28:02 >