Другие языки программирования и технологии

Помогите решить задачу на C++. Двумерные массивы.

Определить сумму элементов, расположенных между первым и последним положительными элементами. Преобразовать массив таким образом, чтобы сначала располагались все элементы, равные нулю, а потом – все остальные... .
Понятия не имею как это сделать но оооочень надо, заранее спасибо))))))))
#include <ctime>
#include <cstdlib>
#include <numeric>
#include <iomanip>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    srand(time(0));
    int a[4][6], *b = &a[0][0], *e = &a[0][0] + 4 * 6;
    cout << "array:\n";
    for (int r = 0; r < 4; ++r) {
        for (int c = 0; c < 6; ++c) cout << setw(3) << (a[r][c] = rand() % 19 - 9);
        cout << endl;
    }
    int *fp = find_if(b, e, bind2nd(greater<int>(), 0));
    int *lp = find_if(
        reverse_iterator<int>(e), reverse_iterator<int>(b),
        bind2nd(greater<int>(), 0)).base();
    cout << "sum: " << accumulate(fp + 1, lp, 0) << endl;
    int *r = remove(reverse_iterator<int>(e), reverse_iterator<int>(b), 0).base();
    fill(b, r, 0);
    cout << "result array:\n";
    for (int r = 0; r < 4; ++r) {
        for (int c = 0; c < 6; ++c) cout << setw(3) << a[r][c];
        cout << endl;
    }
    return 0;
}
Самир Абдуллаев
Самир Абдуллаев
73 839
Лучший ответ
А, без проблем. 150 р. Скайп - mssove Почту знаешь. Пиши.