第六周上機實踐專案3 IP位址類

2021-07-10 23:48:15 字數 787 閱讀 2927

/*

*檔名稱:aaa.cpp

*作 者:趙子琳

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

*版 本 號:v1.0

* *中間用「.」隔開,例如202.194.116.97。其實,也可以看看乙個有4位元組的無符號整型值3401741409。

*/#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(); //返回屬於哪一類網路

};//實現成員函式

第六周實踐專案3 IP 位址類

問題及 檔名稱 text.cpp 完成日期 2016年4月5日 版本號 vc 6.0 輸入描述 程式輸出 輸出結果 includeusing namespace std class ip unsigned char address public ip int 0,int 0,int 0,int 0 ...

第六周專案3 IP位址類

問題及 檔名稱 main.cpp 作 者 趙志君 完成日期 2016年4月5日 版 本 號 v1.0 include include includeusing namespace std class ip 4位元組的ip位址可以看作4部分,每部分1位元組 unsigned int address 4...

第六周專案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...