| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 
 | 
int traduirBit_Ip (int bit)
{
	int bi1=0,bi2=0,bi3=0,bi4=0,bi5=0,bi6=0,bi7=0,bi8=0;//Si on entre le bit ici, la fonction va super
	bi8=(bit/10000000)%2;
	bi7=(bit/1000000)%2;
	bi6=(bit/100000)%2;
	bi5=(bit/10000)%2;
	bi4=(bit/1000)%2;
	bi3=(bit/100)%2;
	bi2=(bit/10)%2;
	bi1=(bit/1)%2;
	return bi8*128+bi7*64+bi6*32+bi5*16+bi4*8+bi3*4+bi2*2+bi1*1;//Calcule la valeur décimal (puissance de 2)
}
int main()
{	int ip1=0, ip2=0, ip3=0, ip4=0;
	int bit1=01010101, bit2=0, bit3=0, bit4=0;
	int test=0;
           printf("Enter l'IP :  ");
	scanf("%i %i %i %i", &ip1, &ip2, &ip3, &ip4);
	testeur_ip(ip1);
	testeur_ip(ip2);//Verifie si l'ip est entre 0 et 255
	testeur_ip(ip3);
	testeur_ip(ip4);
          ip1=traduirBit_Ip(bit1);
          ip2=traduirBit_Ip(bit2);
          ip3=traduirBit_Ip(bit3);
          ip4=traduirBit_Ip(bit4);
          printf("%i %i %i %i", ip1, ip2, ip3, ip4);
          system("pause");
          return 0;
} | 
Partager