I need to convert this line to use cin.
sscanf(s, "%*s%d", &d);
What's the difference between sscanf and scanf and cin?
I need to convert this line to use cin.
sscanf(s, "%*s%d", &d);
What's the difference between sscanf and scanf and cin?
You can't for two reasons. First, cout is for output and the scanf family is for input, but also sscanf parses a string, so the iostream equivalent would be an istringstream.
Secondly, the format string can't be matched. The first directive (%*s) reads non-whitespace characters (as a string because of the S) and then discards them (because of the asterisk). The second directive reads an int, but any integer that would have been present at this point would have already been read and discarded. After the first directive, you will either have no more input characters or the next character will be whitespace.
If, instead, you had:
sscanf(s, "%*s %d", &d)
Then you would read non-whitespace, some whitespace, and then an integer. The easiest stringstream equivalent to this would be:
std::istringstream ss (s); // Put the initial string s into the stream.
int d;
std::string _; // Used but then ignored; this is easier than alternatives.
ss >> _ >> d;