Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <time.h>
- using namespace std;
- const int N = 5;
- const int P = 5;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int a[N][P];
- int numb;
- srand(time(0));
- cout << "Введите цифру для разной генерации случайных чисел: ";
- cin >> numb;
- if (numb == 1)
- {
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- a[i][j] = rand() * 10 - 6;
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- }
- else if (numb == 2)
- {
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- a[i][j] = rand() * 23 - 6;
- cout << a[i][j] << " " ;
- }
- cout << endl;
- }
- cout << endl;
- }
- else if (numb == 1)
- {
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- a[i][j] = rand() + 4 * 3 - 3;
- cout << a[i][j] << " ";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement