第六周專案3 IP位址類

2021-07-10 23:53:32 字數 721 閱讀 4457

問題及**:

/*

* 檔名稱:main.cpp

* 作 者:趙志君

* 完成日期:2023年4月5日

* 版 本 號:v1.0

* */

#include#include#includeusing namespace std;

class ip

; //4位元組的ip位址可以看作4部分,每部分1位元組

unsigned int address; //4位元組的ip位址可以看成乙個4位元組的整體

};public:

ip(int=0,int=0,int=0,int=0); //建構函式

void showip(); //用四段法顯示ip位址

bool samesubnet(const ip &ip, const ip &mark); //判斷是否處於同一子網

char whatkind(); //返回屬於哪一類網路

學習心得:基本都是複製的賀老師的,雖然明白了ip的原理,但對於**中的實現,還有很多不懂得。

第六周專案3 IP位址類

問題及 檔名稱 test.cpp 完成日期 2016年4月6日 輸入 程式輸出 include using namespace std class ip unsigned int address public ip int,int,int,int void showip bool samesubne...

第六周專案3 IP位址類

問題及 檔名稱 test.cpp 完成日期 2016年4月13日 版本號 v1.0 輸入描述 無。include using namespace std class ip public ip int 0,int 0,int 0,int 0 void showip bool samesubnet co...

第六周專案3 IP位址類

2015.煙台大學計算機與控制工程學院 all rightreserved.檔名稱 test.cpp 完成日期 2016年4月21日。問題及 在網際網路中使用的ip位址佔4位元組,可以用四段法表示,每段值的範圍為0 255,中間用 隔開,例如202.194.116.97。其實,也可以看看乙個有4位元...