Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int n, m;
- cout << "rows: " << endl;
- cin >> n;
- cout << "columns: " << endl;
- cin >> m;
- int** arr = new int*[n]; // ARRAY
- for (int i = 0; i < n; ++i)
- arr[i] = new int[m];
- for (int i = 0; i < n; i++) // ARRAY INPUT
- {
- for (int j = 0; j < m; j++)
- {
- arr[i][j] = rand() % 135 + (-12);
- }
- }
- for (int i = 0; i < n; i++) // ARRAY OUTPUT
- {
- for (int j = 0; j < n; j++)
- {
- cout << arr[i][j] << endl;
- }
- }
- delete[] arr; // FREEING MEMORY
- }
Add Comment
Please, Sign In to add comment