Polnochniy

Untitled

Nov 11th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 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][P];
  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.  
  20. for (int j = 0; j < P; j++)
  21. {
  22. a[i][j] = rand()*10-6;
  23. cout << a[i][j] << " ";
  24. }
  25. }
  26. }
  27. else if (numb == 2)
  28. {
  29. for (int i = 0; i < N; i++)
  30. {
  31.  
  32. for (int j = 0; j < P; j++)
  33. {
  34. a[i][j] = rand() * 23 - 6;
  35. cout << a[i][j] << " ";
  36. }
  37. }
  38. }
  39. else if (numb == 1)
  40. {
  41. for (int i = 0; i < N; i++)
  42. {
  43.  
  44. for (int j = 0; j < P; j++)
  45. {
  46. a[i][j] = rand() +4*3-3;
  47. cout << a[i][j] << " ";
  48. }
  49. }
  50. }
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment