jonnyboy23
New Coder
Code:
int main() {
string happy = "24 1.99 42";
int loc = happy.find(" "), loc2 = happy.find(" ", loc + 1, loc + 5);
cout << "LOC 1: " << loc << endl;
cout << "LOC 2: " << loc2 << endl;
return 0;
}
So I am attempting to find the two locations of the spaces
My first value comes out as index 2, so that is correct
However, loc2 comes out as -1 instead of 7