Professional Documents
Culture Documents
main(){
string s1;
cin>>s1;
cout<<s1;
// string::find_first_not_of
#include <iostream> // std::cout
#include <string> // std::string
#include <cstddef> // std::size_t
int main ()
{
std::string str ("look for non-alphabetic characters...");
if (found!=std::string::npos)
{
std::cout << "The first non-alphabetic character is " << str[found];
std::cout << " at position " << found << '\n';
}
return 0;
}
std::size_t is commonly used for array indexing and loop counting. Programs that use other types, such
as unsigned int, for array indexing may fail on, e.g. 64-bit systems when the index exceeds UINT_MAX or if
it relies on 32-bit modular arithmetic.