#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 last occurrence of a character - equivalent of strrchr()
string::size_type index = typing.rfind( 'u' );
if( index != string::npos )
cout << "\nThe last \"u\" is at index " << index;
else
cout << "\nThere is no \"u\" in the string";
}
|