mardi 27 avril 2021

How to use ternary Operator in my C/C++ code

I have 3 values. Can you guide me on how can I use the ternary operator instead of if-else if statement in the mentioned example?

if(status == ok)
{
  return;
}
else
{
 if(status == warning)
 {
   return E_ABORT;
 } 
 else if(status == stop)
 { 
   return E_FAIL;
 }

In 2 cases (stop and warning) i want message and in ok case just want return, no message want to display

Aucun commentaire:

Enregistrer un commentaire