#include <iostream>
#include <string>
using namespace std;
int main( )
{
string typing( "The quick, brown fox jumps over the lazy dog" );
cout << "String: " << typing << endl;
// find first occurrence of a character - equivalent of strchr()
string::size_type index = typing.find( 'u' );
if( index != string::npos )
cout << "\nThe first \"u\" is at index " << index;
else
cout << "\nThere is no \"u\" in the string";
}
|