Created
November 11, 2022 12:38
-
-
Save SPACE-DOGGO/8efa74029447e5e1487bc47c44a54249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <time.h> | |
using namespace std; | |
//int main() | |
//{ | |
// int count = 5; | |
// | |
// string *ar = new string[count]; | |
// | |
// string lastName; | |
// | |
// for (int i = 0; i < 5; i++) | |
// { | |
// cout << "Enter last name: "; | |
// cin >> lastName; | |
// | |
// ar[i] = lastName; | |
// } | |
// | |
// cout << "\n"; | |
// | |
// for (int i = 0; i < count; i++) | |
// { | |
// cout << ar[i] << "\n"; | |
// } | |
// cout << "\n"; | |
// | |
// for (int i = 0; i < 5; i++) | |
// { | |
// for (int j = i + 1; j < 5; j++) | |
// { | |
// if (strcmp(ar[i].c_str(), ar[j].c_str()) > 0) swap(ar[i], ar[j]); | |
// } | |
// } | |
// | |
// for (int i = 0; i < count; i++) | |
// { | |
// cout << ar[i] << "\n"; | |
// } | |
// cout << "\n"; | |
//} | |
int main() | |
{ | |
setlocale(0, "UKR"); | |
int height1; | |
int width1; | |
int height2; | |
int width2; | |
int height3; | |
int width3; | |
for (int i = 0; i < 3; i++) | |
{ | |
switch (i) | |
{ | |
case 0: | |
{ | |
cout << "Введите количество строк массива " << i + 1 << ": "; | |
cin >> height1; | |
cout << "Введите количество столбцов массива " << i + 1 << ": "; | |
cin >> width1; | |
break; | |
} | |
case 1: | |
{ | |
cout << "Введите количество строк массива " << i + 1 << ": "; | |
cin >> height2; | |
cout << "Введите количество столбцов массива " << i + 1 << ": "; | |
cin >> width2; | |
break; | |
} | |
case 2: | |
{ | |
cout << "Введите количество строк массива " << i + 1 << ": "; | |
cin >> height3; | |
cout << "Введите количество столбцов массива " << i + 1 << ": "; | |
cin >> width3; | |
break; | |
} | |
} | |
int min; | |
cout << "Введите начало диапазона значений массива " << i + 1 << ": "; | |
cin >> min; | |
int max; | |
cout << "Введите конец диапазона значений массива " << i + 1 << ": "; | |
cin >> max; | |
srand(time(NULL)); | |
cout << "\n\n"; | |
switch (i) | |
{ | |
case 0: | |
{ | |
int** A = new int* [height1]; | |
for (int y = 0; y < height1; y++) | |
{ | |
A[y] = new int[width1]; | |
for (int x = 0; x < width1; x++) | |
{ | |
A[y][x] = min + (rand() % (max - min + 1)); | |
cout << A[y][x] << " "; | |
} | |
cout << "\n\n"; | |
} | |
break; | |
} | |
case 1: | |
{ | |
int** B = new int* [height2]; | |
for (int y = 0; y < height2; y++) | |
{ | |
B[y] = new int[width2]; | |
for (int x = 0; x < width2; x++) | |
{ | |
B[y][x] = min + (rand() % (max - min + 1)); | |
cout << B[y][x] << " "; | |
} | |
cout << "\n\n"; | |
} | |
break; | |
} | |
case 2: | |
{ | |
int** C = new int* [height3]; | |
for (int y = 0; y < height3; y++) | |
{ | |
C[y] = new int[width3]; | |
for (int x = 0; x < width3; x++) | |
{ | |
C[y][x] = min + (rand() % (max - min + 1)); | |
cout << C[y][x] << " "; | |
} | |
cout << "\n\n"; | |
} | |
break; | |
} | |
} | |
cout << "\n\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment