1 #include <stdio.h> 2 #include <string> 3 #include <iostream> 4 #include <fstream> 5 #include <iterator> 6 #include <vector> 7 #include <algorithm> 8 #include <map> 9 using namespace std; 10 void print(const string s) 11 { 12 cout<<s<<endl; 13 } 14 bool gt_str_1(string s) 15 { 16 return s>"1"; 17 } 18 int main() 19 { 20 21 ifstream is("1"); 22 23 istream_iterator<string> ii(is); 24 istream_iterator<string> eos; 25 26 27 vector<string> v(ii,eos); 28 for_each(v.begin(),v.end(),print); 29 cout<<count_if(v.begin(),v.end(),gt_str_1)<<endl; 30 31 return 0; 32 }