fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. #include <math.h>
  4.  
  5. int main() {
  6. printf("Bilangan = ");
  7. int bilangan;
  8. scanf("%d", &bilangan);
  9.  
  10. int a = 0;
  11. int y;
  12.  
  13. while(bilangan>0)
  14. {
  15. bilangan = bilangan / 2;
  16. if(bilangan == 0)
  17. {
  18. a = a + 1;
  19. y = pow(2 ^ 0);
  20. int arr[a] = y;
  21. printf("%d", arr[a]);
  22. }
  23. }
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 15232KB
stdin
1
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:19:19: error: no matching function for call to ‘pow(int)’
      y = pow(2 ^ 0);
                   ^
In file included from /usr/include/features.h:364:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
                 from /usr/include/c++/6/iostream:38,
                 from prog.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate: double pow(double, double)
 __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:3:
/usr/include/c++/6/cmath:438:5: note: candidate: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^~~
/usr/include/c++/6/cmath:438:5: note:   template argument deduction/substitution failed:
prog.cpp:19:19: note:   candidate expects 2 arguments, 1 provided
      y = pow(2 ^ 0);
                   ^
In file included from /usr/include/c++/6/math.h:36:0,
                 from prog.cpp:3:
/usr/include/c++/6/cmath:415:3: note: candidate: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^~~
/usr/include/c++/6/cmath:415:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/cmath:411:3: note: candidate: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^~~
/usr/include/c++/6/cmath:411:3: note:   candidate expects 2 arguments, 1 provided
prog.cpp:20:19: error: array must be initialized with a brace-enclosed initializer
      int arr[a] = y;
                   ^
stdout
Standard output is empty