Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <chrono>
  4. #include <random>
  5.  
  6. int main()
  7. {
  8. const int n = 10;
  9. double tab[n];
  10.  
  11. std::default_random_engine silnik;
  12. silnik.seed(std::chrono::system_clock::now().time_since_epoch().count());
  13. std::normal_distribution<double> wzrost(170, 10);
  14.  
  15. double wynik;
  16. for (int i = 0; i < n; i++)
  17. {
  18. tab[i] = wzrost(silnik);
  19. }
  20. for (int p = 0; p < n; p++)
  21. {
  22. std::cout << tab[p] << std::endl;
  23. }
  24.  
  25. int m = 0;
  26. for (int o = 1; o < n; o++)
  27. {
  28. if (tab[o] < tab[m])
  29. {
  30. double u = tab[m];
  31. m = o;
  32. tab[o] = u;
  33. }
  34. }
  35.  
  36. //minimalna dla corach mniejszych tablic
  37. //tablica constxconst spirala liczb
  38.  
  39.  
  40. std::cout << std::endl<< tab[m];
  41.  
  42. for(int i=0;i<n;i++)
  43. {
  44. tab[i];
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement