Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int tab[]={2435,67,38,4,3,2,76,8,90,10};
  5. int tab2[10];
  6. void wyswietl()
  7. {
  8. for (int i = 0;i<10;i++)
  9. {
  10. cout<<tab[i]<<"\t ";
  11. }
  12. cout<<endl;
  13. }
  14. void wpisz()
  15.  
  16. {
  17. for (int i = 0;i<10;i++)
  18. {
  19. //cin>>tab2[i];
  20. tab2[i] = (rand() % 1000) + 1;
  21. }
  22. }
  23. void wyswietl2()
  24. {
  25. for (int i = 0;i<10;i++)
  26. {
  27. cout<<tab2[i]<<"\t ";
  28. }
  29. }
  30. int najmniejsza()
  31. {
  32. int mala = 99999;
  33. int index = 0;
  34. for (int i = 0;i<10;i++)
  35. {
  36. if(tab[i]< mala)
  37. {
  38. mala = tab[i];
  39. index = i;
  40. }
  41. }
  42. return index;
  43. }
  44. int main()
  45. {
  46. wyswietl();
  47. wpisz();
  48. wyswietl2();
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement