String read-in by line
getline(cin, s1);
string deletes the specified character
Move the element with the value Val to the end, and return the Newend iterator through remove in algorithm
Use String.erase to remove elements from the newend and end ranges
s1.erase(remove(s1.begin(), s1.end(), s2[i]), s1.end());
The difference between the Find function
Find is provided in both string and algorithm.
Std::find function template
Emplate <class Inputiterator, class t>
Inputiterator Find (inputiterator First, Inputiterator last, const t& val);
Input parameters
Find iterators for scopes, and find values
return value
The first iterator that matches the element that has no matching result returns the last iterator
Std::string::find overloading
String (1)
size_t Find (const string& str, size_t pos = 0) const noexcept;
C-string (2)
size_t Find (const char* s, size_t pos = 0) const;
Buffer (3)
size_t Find (const char* s, size_t pos, size_type N) const;
Character (4)
size_t Find (char c, size_t pos = 0) const noexcept;
Input parameters
STR/S/C: The string/character to look for
POS: Looking for the starting position
N: The length of the match
return value
Returns the position of the first matching element found (size_t)
Return String::npos if not found
Output specified precision
printf ("%.2f", num)
[C + +] string processing