How do you do use this? I sort of know what it does, but I don't understand how.
How do you do use this? I sort of know what it does, but I don't understand how.
Condition ? TruePart : FalsePart
It's mainly used for replacing if statements:
Code:theNumber *= ( doDouble == true ? 2 : 1 );
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
The output would be 1. Read it like this, if test is equal to 1 then test equals 1, else test equals 0.Code:int true=1; int test=0; test = (true==1) ? 1 : 0; cout << test << endl;
Read it like this, if test is equal to 1 then test equals 1, else test equals 0.
He meant "if true is equal to 1 then test equals 1, else test equals 0.
Away.
Oops...Thank you for the correction. Misstyped it and forgot to re-read my post.