Untitled
unknown
c_cpp
a month ago
680 B
4
Indexable
Never
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { const int rows = 10; const int cols = 10; int tab[rows][cols]; srand(time(0)); for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { int sign = (rand() % 2 == 0) ? 1 : -1; int number = (rand() % 90) + 10; tab[i][j] = number * sign; } } for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { cout << tab[i][j] << "\t"; } cout << endl; } std::cout << "\n\n"; return 0; }
Leave a Comment