fork(1) 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. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
10
20
10