I want to compare a hexadecimal with a hexadecimal and show if its the same. For Example:
decimal = 255
ExpResult = FF
Hex[x] = FF --> true
//The part above ist the converterpart (dec in hex)
void decimalinhexadecimal(int t, int decimal , char ExpResult ) //
{
long int num;
int i = 1, x, y;
char hexa[100];
num = decimal;
while (num != 0) {
y = num % 16;
if (y < 10)
y = y + 48;
else
y = y + 55;
hexa[i++] = y;
num = num / 16;
}
printf("Hexadecimal:" );
for (x = i - 1; x> 0; x--)
printf("%c", hexa[x]);
// This One is the test part
if (t >= 1)
{
if (ExpResult != hexa[x]) // this one didnt work
{
printf("\n");
printf("Error no hex\n");
}
else
{
printf("\n");
printf("Erfolg!\n");
}
}
else
{
return;
}
}
Aucun commentaire:
Enregistrer un commentaire