My question is for example I have 3 variables;
int y, m ,d;
Is there anyway that I can take user input in the form of YYYY/MM/DD and store YYYY into y, MM into m, and DD into d by using std::istream functions?
My question is for example I have 3 variables;
int y, m ,d;
Is there anyway that I can take user input in the form of YYYY/MM/DD and store YYYY into y, MM into m, and DD into d by using std::istream functions?
As far as I know, you can't specify a delimiter with >> you can use the following:
std::string input;
cin.getline(input, 4, '/');
Then you would convert that to int by doing: int years = std::stoi(input);