fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void convert(int &i, int value) {
  5. i = !!i * -1 & value;
  6. }
  7.  
  8. int main() {
  9. int result1 = 5, result2 = 2, result3 = 0;
  10.  
  11. convert(result1, 128);
  12. convert(result2, 64);
  13. convert(result3, 32);
  14.  
  15. cout << result1 << " " << result2 << " " << result3 << std::endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 4540KB
stdin
Standard input is empty
stdout
128 64 0