Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "Windows.h"
- using namespace std;
- int main() {
- int n, m;
- cout << "Enter N: ";
- cin >> n;
- cout << endl;
- cout << "Enter M: ";
- cin >> m;
- cout << endl;
- HANDLE heap = HeapCreate(0, (n*m*sizeof(int)), (n*m*sizeof(int)));
- int **arr = (int**)HeapAlloc(heap, 0, (n*sizeof(int*)));
- for (int i = 0; i < n; i++)
- {
- arr[i] = (int*)HeapAlloc(heap, 0, (m*sizeof(int)));
- for (int j = 0; j < m; j++)
- {
- arr[i][j] = (rand() % 10);
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- int max = -1, min = 100;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- if (arr[i][j] > max)
- {
- max = arr[i][j];
- }
- else if (arr[i][j] < min)
- {
- min = arr[i][j];
- }
- }
- }
- cout << "max: " << max << endl;
- cout << "min: " << min << endl;
- HeapDestroy(heap);
- //delete [] arr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement