Ал
Алена
#include
#include
#include
#include
#include
#include
using namespace std;
struct rnd { int operator()() { return rand() % 51 - 25; } };
struct sum { int operator()(int s, int x) { return x > 0? s + x : s; } };
int main() {
srand(time(0));
int a[20];
generate_n(a, 20, rnd());
cout << "массив: ";
copy(a, a + 20, ostream_iterator
cout << "\nсумма положительных: " << accumulate(a, a + 20, 0, sum()) << endl;
return 0;
}