#include<iostream>
using namespace std;
int main()
{
int n = 2, k = 8;
int res = 1;
cout<<n<<"的"<<k<<"次方等于:";
while(k)
{
if(k & 1)
{
res *= n;
}
n *= n;
k >>= 1;
}
cout<<res<<endl;
return 0;
}
原文:https://blog.51cto.com/14472348/2474986