HP Integrity NonStop H-Series User Manual

Page 177

Advertising
background image

void countCaps(char c) { if (isupper(c)) capCount++; }

The following example counts the number of capital letters in a string value:

string advice = "Never Trust Anybody Over 30!";
for_each(advice.begin(), advice.end(),countCaps);
cout << "upper-case letter count is " << capCount << endl;

Advertising
This manual is related to the following products: