+ 1
[SOLVED] Conditional operator
I couldn't able to assign 10 to x or y #include <iostream> using namespace std; int main() { int value , x , y ; cin >> value ; value > 500 ? x : y = 10 ; cout << x ; return 0; }
2 Antworten
+ 8
Replace
value > 500 ? x : y = 10 ;
with
value > 500 ? ( x = 10 ) : ( y = 10 )
+ 1
Thanks , it solved my problem