Chcę znaleźć najniższą liczbę z czterech, ale to wygląda trochę dziwnie, czy nie jest to mądrzejszy i krótszy sposób to zrobić?Porównaj 4 zmienne, aby znaleźć najniższy C++
To jest to, co mam:
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;
}
Niszczy mnie przez 7 sekund, a ja popełniłem błąd! – Marlon
jest zrównoważone drzewo lepiej 'std :: min (std :: min (a, b), std :: min (c, d));'? – osgx
@osgx: Brak różnicy funkcjonalnej. –