Hi, I am having trouble using find() and substr() to extract 2 names out of one string. eg.
cout << "Enter full name (last,first)";
string name;
cin >> name
cout << "First name" << [this is where i am trying to output the first name];
cout << "Last name" << [this is where i am trying to output the last name];
There may be no spaces in the string name and we are to use find() and substr() to solve this. Please help!
I'm not sure why <cstring> was included in the example. I see no reason for it. As far as the string member functions go, why not just read the interface documentation? This website has a reference page for all algorithms and containers which thoroughly explain how they work and provide examples. Click the reference link in the left hand pane of the web page. I've included a couple for your convenience. I have included the link for std::find as well because it is more generic and uses iterators. I prefer using it when dealing with strings rather than std::string::find.