| Цитата(Gluttton @ 19.12.2013, 09:17) | Код:
| Код | #include <iostream> #include <stdlib.h>
int main (int argc, char * argv []) { constexpr size_t rowCount {3}; constexpr size_t colCount {3}; int matrix [rowCount][colCount] = { {1, 0, 1}, {0, 1, 1}, {0, 1, 0} };
unsigned int nonZeroItemCount {0u};
for (size_t i = 0; i < rowCount; ++i) { for (size_t j = 0; j < colCount; ++j) { if (matrix [i][j]) { ++nonZeroItemCount; } } } std::cout << nonZeroItemCount << std::endl; return EXIT_SUCCESS; }
|
|
Вроде разобралась) Спасибо :3 |