int a = 3, b = 4, c = 5, x;x=a>b?(a>c?a:c):(b>c?b:c);
这个是求三个数的最大值的代码,可以看到其过程类似
int a = 3, b = 4, c = 5, x;if(a>b){ if (a>c)x=a; else x=c;}else { if (b>c)x=b; else x=c;}