Can the following be turned into a switch statement and if yes how? (10 points)?
if(Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_B)
if(gGameApp->mSuperAmmo<=0&&gGameApp-
mPokemon->mReloadingCount=1;
mPokemon->Shoot();
in addition if (gGameApp->mShield > 0&&gGameApp->mSuperAmmo>0)
mPokemon->mReloadingCount=1;
mPokemon->ShootSuper();
in addition if (gGameApp->mAmmo>0)
mPokemon->mReloadingCount=1;
mPokemon->Shoot2();
Any assist appreciated
Assuming this can be C++, really not.I’m undecided why you’d prefer to.
A change statement can be used if you want to compare internet of a good expression next to a number of possible values with the expression.Right here, your conditionals are usually all viewing different stuff, so the principle doesn’t really apply.
Using some languages, such as PHP, you might have non-constant event labels, in order to switch within the value legitimate and apply several unrelated conditionals because your case labels.Nonetheless, honestly, that’s sorts of silly, and provides hardly any benefit within the equivalent if/else develop.
dunno.
Leave a Reply
You must be logged in to post a comment.