#include<iostream>
using namespace std;
int Qtoten(int number,int p)
{
int product=1,x=0;
while(number!=0)
{
x=x+(number%10)*product;
number=number/10;
product*=p;
}
return x;
}
void temtoQ(int number,int p)
{
int temp[40],count=0,num=0;
while(number!=0)
{
temp[num++]=number%p;
number=number/p;
}
while(num!=0)
cout<<temp[--num];
}
int main()
{
int a=111;
cout<<Qtoten(a,2)<<endl;
int b=14;
temtoQ(b,2);
}