topical media & game development
professional-program-22-FunctionObjects-Negators.c
? /
professional-program-22-FunctionObjects-Negators.c
include <algorithm>
include <vector>
include <iostream>
include <functional>
using namespace std;
int main(int argc, char** argv)
{
int num;
vector<int> myVector;
while (true) {
cout << "Enter a test score to add (0 to stop): ";
cin >> num;
if (num == 0) {
break;
}
myVector.push_back(num);
}
vector<int>::iterator it = find_if(myVector.begin(), myVector.end(),
not1(bind2nd(greater_equal<int>(), 100)));
if (it == myVector.end()) {
cout << "All perfect scores\n";
} else {
cout << "Found a \"less-than-perfect\" score of " << *it << endl;
}
return (0);
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.