Checkpoint 7.8.1.
What is the correct output of the code below?
int main() {
string quote = "The way to get started is to quit talking and begin doing.";
cout << find(quote, 't', 11) << ", " << find(quote, 't', 42) << ", " << quote.find('t');
}
- 13,
string::npos
, 8 - Notice how the built-in
find
function works differently from ours. - 13, 0, 7
- Remember that when a character isn’t found, the function returns
string::npos
. - 13,
string::npos
, 0 - Keep in mind that the find function is case sensitive, so ‘A’ is different from ‘a’.
- 14,
string::npos
, 9 - Remember that indexing begins at 0 for C++.