Hi guys I'm not really understanding how I would separate the users inputs when using getline(). For example the user inputs his birth date and from that I extract the month, date, and year from that.
eg.) for Sunday, January 2, 2010. I have
int main()
{
string inputStream;
string date, month, day, year;
string i;
string j;
getline(cin, inputStream);
//cin >> date >> month >> day >> year;
i = inputStream.substr(0, inputStream.find(","));
j = inputStream.substr(inputStream.find(","), inputStream.find(","));
date = i;
month = j;
cout << month << " " << day << " was a " << date << " in" << year << endl;
return0;
}
For i it works properly and will display sunday but for j it doesn't seem to want to work. Can someone show me where I went wrong? I'm not sure how I would extract the next value after the date.