fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool checkNegative(int num){
  4. bool hasNegative=false;
  5. if(num<0){
  6. hasNegative=true;
  7. }
  8. return hasNegative;
  9. }
  10. int main() {
  11. int n;
  12. cin>>n;
  13. cout<<checkNegative(n);
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5324KB
stdin
-2
stdout
1