// This example (part of a series) illustrates how to to use a functor. // // This code uses the transform algorithm, rather than the explicit loop // from the previous example. #include #include #include using namespace std; char embiggen(char c) { if ('a' <= c && c <= 'z') return c - 'a' + 'A'; else return c; } int main() { string name = "Beverly Hills Chihuahua"; string result = name; transform(name.begin(), name.end(), result.begin(), embiggen); cout << result << '\n'; }