Guest User

Untitled

a guest
Jul 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. int findlowest(int one, int two, int three, int four) {
  2. int output = one //as of now , we will be outputting one , except if we find a lower score.
  3. if(output > two) { out = two;} // if output is proven to be bigger than two, two is our new output.
  4. if(output > three){ output = three;} //same operation with three
  5. if(output > four){ output = four;} // same operation with four
  6. return output;
  7. }
  8.  
  9. int minimum = std::min( { 1,2,3,4,5 } );
  10.  
  11. min_int = min(min(one, two), min(three, four));
  12.  
  13. int a[] = {1,2,3,4,5};
  14. int minimum = *std::min_element(a, a+5);
  15.  
  16. int findlowest(int a, int b, int c, int d)
  17. {
  18. int of_a_b = a < b ? a : b;
  19. int of_c_d = c < d ? c : d;
  20. return of_a_b < of_c_d ? of_a_b : of_c_d;
  21. }
  22.  
  23. template <typename T>
  24. T findlowest(const T& a, const T& b, const T& c, const T& d)
  25. {
  26. const T& of_a_b = a < b ? a : b;
  27. const T& of_c_d = c < d ? c : d;
  28. return of_a_b < of_c_d ? of_a_b : of_c_d;
  29. }
Add Comment
Please, Sign In to add comment