// By bodesmile
// Start:
// Algorithm:
// Note:
# Include <iostream>
Using namespace STD;
Class base_12;
Class base_16
{
Public:
Base_16 (int A, int B, int C, int D)
{
Num [0] = D;
Num [1] = C;
Num [2] = B;
Num [3] =;
}
Void b16_add ()
{
If (Num [0] <15)
{
Num [0] ++;
}
Else if (Num [1] <15)
{
Num [0] = 0;
Num [1] ++;
}
Else if (Num [2] <15)
{
Num [0] = 0;
Num [1] = 0;
Num [2] ++;
}
Else
{
Num [0] = 0;
Num [1] = 0;
Num [2] = 0;
Num [3] ++;
}
}
Friend bool comp12and16 (int I, base_12 num12, base_16 num16 );
PRIVATE:
Int num [4];
};
Class base_12
{
Public:
Base_12 (int A, int B, int C, int D)
{
Num [0] = D;
Num [1] = C;
Num [2] = B;
Num [3] =;
}
Void b12_add ()
{
If (Num [0] <11)
{
Num [0] ++;
}
Else if (Num [1] <11)
{
Num [0] = 0;
Num [1] ++;
}
Else if (Num [2] <11)
{
Num [0] = 0;
Num [1] = 0;
Num [2] ++;
}
Else
{
Num [0] = 0;
Num [1] = 0;
Num [2] = 0;
Num [3] ++;
}
}
Friend bool comp12and16 (int I, base_12 num12, base_16 num16 );
PRIVATE:
Int num [4];
};
Bool comp12and16 (int I, base_12 num12, base_16 num16)
{
Int temp = 0;
Temp + = (I % 10 );
I/= 10;
Temp + = (I % 10 );
I/= 10;
Temp + = (I % 10 );
I/= 10;
Temp + = I;
Int temp1, temp2;
Temp1 = num12.num [0] + num12.num [1] + num12.num [2] + num12.num [3];
If (temp! = Temp1)
Return false;
Temp2 = num16.num [0] + num16.num [1] + num16.num [2] + num16.num [3];
If (temp! = Temp2)
Return false;
Return true;
}
Int main ()
{
//
Base_16 num16 );
Base_12 num12 (0, 6, 11, 4 );
Int I;
For (I = 1000; I <10000; I ++)
{
If (comp12and16 (I, num12, num16 ))
Cout <I <Endl;
Num16.blob _ add ();
Num12.b12 _ add ();
}
Return 0;
}