Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #define N 5
  3. using namespace std;
  4.  
  5. double whoisbest(double tab[],double ile)
  6. {
  7. double maximus=tab[0];
  8. for(int i=0;i<ile;i++)
  9. {
  10. if(maximus>tab[i])
  11. maximus=tab[i];
  12. }
  13. return maximus;
  14. }
  15.  
  16. int main()
  17. {
  18. double przejazdy[N],x;
  19. int licznik=0;
  20. for(int i=0;i<N;i++)
  21. {
  22. cout<<"Podaj czas przejazdu nr " <<i+1<<endl;
  23. cin>>x;
  24. if(x==0)
  25. break;
  26. else
  27. przejazdy[i]=x;
  28. licznik++;
  29. }
  30. cout<<whoisbest(przejazdy,licznik)<<endl;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement