#include <iostream>
using namespace std;
#include <math.h>
int main() {
printf("Bilangan = ");
int bilangan;
scanf("%d", &bilangan);
int a = 0;
int y;
while(bilangan>0)
{
bilangan = bilangan / 2;
if(bilangan == 0)
{
a = a + 1;
y = pow(2 ^ 0);
int arr[a] = y;
printf("%d", arr[a]);
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojaW5jbHVkZSA8bWF0aC5oPgoKaW50IG1haW4oKSB7CglwcmludGYoIkJpbGFuZ2FuID0gIik7CglpbnQgYmlsYW5nYW47CglzY2FuZigiJWQiLCAmYmlsYW5nYW4pOwoJCglpbnQgYSA9IDA7CglpbnQgeTsKCQoJd2hpbGUoYmlsYW5nYW4+MCkKCQl7CgkJCWJpbGFuZ2FuID0gYmlsYW5nYW4gLyAyOwoJCQlpZihiaWxhbmdhbiA9PSAwKQoJCQkJewoJCQkJCWEgPSBhICsgMTsKCQkJCQl5ID0gcG93KDIgXiAwKTsKCQkJCQlpbnQgYXJyW2FdID0geTsKCQkJCQlwcmludGYoIiVkIiwgYXJyW2FdKTsKCQkJCX0KCQl9CglyZXR1cm4gMDsKfQ==
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;
^