Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Ternary Operator Help (http://www.go4expert.com/forums/ternary-operator-help-t6584/)

pradeep 28Sep2007 14:17

Ternary Operator Help
 
Can anyone help me write this Excel formula in C/C++
Code:

=IF(C3>300000;IF(C3>600000;IF(C3>900000;IF(C3>1200000;IF(C3>1800000;IF(C3>2399999;300000);210000);90000);60000);45000);0)

shabbir 28Sep2007 17:06

Re: Ternary Operator Help
 
My Excel says its an invalid one.

pradeep 28Sep2007 18:16

Re: Ternary Operator Help
 
It's a valid one, cause I used it on an Excel sheet, btw i have solved it,
Code: C

(iCtc>300000)?(iCtc>600000)?(iCtc>900000)?(iCtc>1200000)?(iCtc>1800000)?(iCtc>2399999)?300000:0:210000:90000:60000:45000:0;



All times are GMT +5.5. The time now is 15:37.