首页 > 其他 > 详细

输出ip最后一个点之后的数字

时间:2015-12-16 12:33:20      阅读:83      评论:0      收藏:0      [点我收藏+]

#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <cstring>
#include <cmath>
#include <iostream>  
#include <string>  
#include <WinSock.h>  
#include <fstream>  
//#pragma comment(lib,"ws2_32.lib")
using namespace  std;
//bool sort(char * num,int totalNum);

void _tmain(int argc, _TCHAR* argv[])
{

      string IP1="172.16.26.29";

      string IP2="172.16.26.169";

      string IP3="172.16.223.23";

      string ss0=IP1.substr(IP1.find_last_of(‘.‘)+1,3);

      string ss1=IP2.substr(IP2.find_last_of(‘.‘)+1,3);

      string ss2=IP3.substr(IP3.find_last_of(‘.‘)+1,3);

      cout<<ss0<<endl;

     cout<<ss1<<endl;

     cout<<ss2<<endl;

}

输出:29

        169

        23

输出ip最后一个点之后的数字

原文:http://www.cnblogs.com/loda333/p/5050662.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!