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];
- int numb;
- srand(time(0));
- cout << "Введите цифру для разной генерации случайных чисел: ";
- cin >> numb;
- if (numb == 1)
- {
- for (int i = 0; i < N; i++)
- {
- a[i] = rand();
- cout << a[i]<<" "<< endl;
- }
- for (int j = 0; j < P; j++)
- {
- a[j] = rand();
- cout << a[j] <<" " << endl;
- }
- }
- else if (numb == 2)
- {
- for (int i = 0; i < N; i++)
- {
- a[i] = rand();
- cout << a[i] << " " << endl;
- }
- for (int j = 0; j < P; j++)
- {
- a[j] = rand();
- cout << a[j] <<" "<< endl;
- }
- }
- else if (numb == 3)
- {
- for (int i = 0; i < N; i++)
- {
- a[i] = rand();
- cout << a[i]<<" " << endl;
- }
- for (int j = 0; j < P; j++)
- {
- a[j] = rand();
- cout << a[j]<<" " << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment