英文:
How to define min or max to determine the minimum value between tow numbers or in array?
问题
I have recently defined a code for a problem in CPLEX and I have encountered a syntax error when I wanted to get the minimum value in an array. please see the code provided below as an example.
float Y = min (2.3, 3, 4, 2, 13, 45)
I got this error: syntax error, unexpected ',', expecting in
英文:
I have recently defined a code for a problem in CPLEX and I have encountered a syntax error when I wanted to get the minimum value in an array. please see the code provided below as an example.
float Y = min (2.3, 3, 4, 2, 13, 45)
I got this error: syntax error, unexpected ',', expecting in
答案1
得分: 0
你可以使用 minl 函数:
float Y = minl(2.3, 3, 4, 2, 13, 45);
execute
{
writeln(Y);
}
结果是:
2
英文:
You can use minl
float Y = minl (2.3, 3, 4, 2, 13, 45);
execute
{
writeln(Y);
}
gives
2
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论