二进制32位IP到十进制
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # include <stdio.h> 2 # include <string.h> 3 # include <math.h> 4 int main() 5 { 6 char ch[35]; 7 int n,i,t,j; 8 int sum; 9 scanf("%d",&t); 10 while(t--) 11 { 12 n=0; 13 scanf("%s",ch); 14 for(i=0;i<4;i++) 15 { 16 sum=0; 17 for(j=0;j<8;j++) 18 { 19 sum+=(ch[i*8+j]-'0')*pow(2,7-j); 20 } 21 if(n) 22 printf("."); 23 n++; 24 printf("%d",sum); 25 } 26 printf("\n"); 27 } 28 return 0; 29 }