lundi 13 avril 2020

How do I return value and end condition after first true in c++?

I need to return the value for the first true and then end the condition.

Example code:

if (z > 0) 
return t;
return 0;

Where t is deemed as the month of projection and z is dependent of t. I would like this condition to return t when the first true is met and then end the condition (or 0 for next truths).

Alternatively this condition could enumerate the truths - return 1 after 1st true, 2 after second..

The case is I need to know at which t z is highier than 0 for the first time.

Aucun commentaire:

Enregistrer un commentaire