2012年10月18日
摘要: STL的find_if函数功能很强大,可以使用输入的函数替代等于操作符执行查找功能(这个网上有很多资料,我这里就不多说了)。比如查找一个数组中的奇数,可以用如下代码完成(具体参考这里:http://www.cplusplus.com/reference/algorithm/find_if/):#include <iostream>#include <algorithm>#include <vector>using namespace std;bool IsOdd (int i) { return ((i%2)==1);}int main () { vecto 阅读全文
posted @ 2012-10-18 21:17 Mike_Zhang 阅读(2149) 评论(5) 推荐(2) 编辑