28 for (
unsigned int i=0; i<x.size(); ++i)
43 copy(x.cbegin(), x.cend(), ostream_iterator<T>(s,
" "));
59 return std::abs(i)>std::abs(j);
72 cout <<
"Hello world!" << endl;
75 vector<double> v{-1,-3,-3,4,-1,4};
83 copy(v.begin(),v.end(),z.begin());
93 auto it = find(v.begin(),v.end(),4);
96 cout <<
"gefunden " << *it << endl;
98 cout << it - v.begin() << endl;
100 sort(v.begin(),v.end());
101 cout <<
" sort (aufsteigend) " << v << endl;
103 it = unique(v.begin(),v.end());
105 cout << it - v.begin() << endl;
111 sort(v.begin(),v.end(),greater<double>());
113 sort(v.begin(),v.end(), [](
auto a,
auto b){return a>b;} );
117 auto ip = find_if(v.begin(),v.end(),
IsNegative);
118 cout <<
"erste negative Zahl: " << *ip << endl;
121 auto ip2 = find_if(v.begin(),v.end(),
122 [](
double a) ->
bool { return a<0.0; }
124 cout <<
"erste negative Zahl: " << *ip2 << endl;
127 int p = count(z.begin(),z.end(),-3);
128 cout <<
" z : " << z << endl;
129 cout <<
"p(-3) :" << p << endl;
131 cout <<
"p(neg.) :" << p << endl;
133 cout <<
"#############################################\n";
136 vector<Komplex> kv{
Komplex(1,3),
Komplex(2,5),
Komplex(-1,3),
Komplex(1,4),
Komplex(1,3),
Komplex(1,3) };
137 const vector<Komplex> kz(kv);
140 sort(kv.begin(),kv.end());
143 auto ik=find(kv.begin(),kv.end(),
Komplex(1,4));
146 cout <<
"gefunden " << *ik << endl;
150 double const vergl=2.0;
151 int n2 = count_if(cbegin(kv),cend(kv),
152 [vergl] (
auto const &a) {
return std::abs(a.Get_re())<vergl;}
154 cout <<
"|re| < 2 in " << n2 <<
" Elementen." << endl;
157 cout <<
"-------- jetzt Liste -----------\n";
158 list<Komplex> al(kz.begin(),kz.end());
167 list<Komplex> ip_al = find(cbegin(al),cend(al),
169 {
return fim==a.Get_im(); }
bool IsLargerAbs(double i, double j)
bool IsNegative(double i)
bool IsLarger(double i, double j)
ostream & operator<<(ostream &s, const vector< T > &x)