简单梳理 arp 表格,将ip地址的前导0补全方便今后的数据处理。
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
/****
简单处理 arp 表格。
A.B.C.D 0015-0015-0015 0 Tunnel257 N/A O
转换为
000A.000B.000C.000D#0015-0015-0015
*****/
int main()
{
freopen("geAA.txt","r",stdin);
freopen("AA.txt","w",stdout);
char ch[100];
while(cin.getline(ch,100))
{
string str=ch;
string str1="0";
int buwei=0;
for(int i=0;;i++)
{
if(str[i]=='.')
A: if(i%4==3)
continue;
else
{
str.insert((i/4)*4,"0");
i++;
goto A;
}
/*
优先处理为 000A.00