Есть ли способ сделать эту функцию более элегантной? Я новичок в С++, я не знаю, есть ли более стандартизированный способ сделать это. Может ли это быть превращено в цикл, поэтому количество переменных не ограничено, как с моим кодом?
float smallest(int x, int y, int z) {
int smallest = 99999;
if (x < smallest)
smallest=x;
if (y < smallest)
smallest=y;
if(z < smallest)
smallest=z;
return smallest;
}