Advertisement
Polnochniy

Untitled

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