Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int findlowest(int one, int two, int three, int four) {
- int output = one //as of now , we will be outputting one , except if we find a lower score.
- if(output > two) { out = two;} // if output is proven to be bigger than two, two is our new output.
- if(output > three){ output = three;} //same operation with three
- if(output > four){ output = four;} // same operation with four
- return output;
- }
- int minimum = std::min( { 1,2,3,4,5 } );
- min_int = min(min(one, two), min(three, four));
- int a[] = {1,2,3,4,5};
- int minimum = *std::min_element(a, a+5);
- int findlowest(int a, int b, int c, int d)
- {
- int of_a_b = a < b ? a : b;
- int of_c_d = c < d ? c : d;
- return of_a_b < of_c_d ? of_a_b : of_c_d;
- }
- template <typename T>
- T findlowest(const T& a, const T& b, const T& c, const T& d)
- {
- const T& of_a_b = a < b ? a : b;
- const T& of_c_d = c < d ? c : d;
- return of_a_b < of_c_d ? of_a_b : of_c_d;
- }
Add Comment
Please, Sign In to add comment