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;
- 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;
- }
- }
- else if(numb ==2)
- {
- for (int i = 0; i < N; i++)
- {
- a[i] = 50*rand()-25;
- cout << a[i] << endl;
- }
- }
- else if (numb == 3)
- {
- for (int i = 0; i < N; i++)
- {
- a[i] = 2* rand() - 25/2;
- cout << a[i] << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment