Polnochniy

Untitled

Nov 11th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <time.h>
  4. using namespace std;
  5. const int N = 5;
  6. const int P = 5;
  7. int main()
  8. {
  9. setlocale(LC_ALL, "Rus");
  10. int a[N];
  11. int numb;
  12. srand(time(0));
  13. cout << "Введите цифру для разной генерации случайных чисел: ";
  14. cin >> numb;
  15. if (numb == 1)
  16. {
  17. for (int i = 0; i < N; i++)
  18. {
  19. a[i] = rand();
  20. cout << a[i]<<" "<< endl;
  21. }
  22. for (int j = 0; j < P; j++)
  23. {
  24. a[j] = rand();
  25. cout << a[j] <<" " << endl;
  26. }
  27. }
  28. else if (numb == 2)
  29. {
  30. for (int i = 0; i < N; i++)
  31. {
  32. a[i] = rand();
  33. cout << a[i] << " " << endl;
  34. }
  35. for (int j = 0; j < P; j++)
  36. {
  37. a[j] = rand();
  38. cout << a[j] <<" "<< endl;
  39. }
  40. }
  41. else if (numb == 3)
  42. {
  43. for (int i = 0; i < N; i++)
  44. {
  45. a[i] = rand();
  46. cout << a[i]<<" " << endl;
  47. }
  48. for (int j = 0; j < P; j++)
  49. {
  50. a[j] = rand();
  51. cout << a[j]<<" " << endl;
  52. }
  53. }
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment