fork download
  1. #include <iostream>
  2. using namespace std;
  3. int getNumber(bool &check) {
  4. check = !check;
  5. return check ? 10 : 20;
  6. }
  7.  
  8. int main() {
  9. bool numero = false;
  10. cout << getNumber(numero) << endl;
  11. cout << getNumber(numero) << endl;
  12. cout << getNumber(numero) << endl;
  13. }
  14.  
  15. //https://pt.stackoverflow.com/q/45723/101
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
10
20
10