Home > Back-end >  Dear bosses, can help to take a look at this how to write
Dear bosses, can help to take a look at this how to write

Time:06-03

IP address translation, explanation: an IP address by 4 bytes each byte (eight bits) composed of binary code, please will represent the IP address of the 32-bit binary code into four period of decimal format of the IP address format output, use among. Separated, example: input, output: 11001100100101000001010101110010 204.148.21.114

CodePudding user response:

#include
#include
Int main ()
{
Char STR [33].
The scanf (" % s ", STR);
The union Value {
Int v.
Unsigned char c [4];
} the value;
Int j=0;
Value. V=0;
For (; j<32. J++) {
Value. V<=1;
If (STR [j]=='1')
Value. V |=1;
}
Printf (" % d, % d, % d, % d \ n ", value, c [3], the value. The c [2], the value. The c [1], the value. The c [0]).
return 0;
}

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related