Untitled
unknown
c_cpp
a year ago
680 B
11
Indexable
#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;
}
Editor is loading...
Leave a Comment