第六周專案三 IP位址類

2021-07-10 23:47:12 字數 734 閱讀 7042

/*

*檔名稱:123.cpp

*作 者:王蕊

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

*版 本 號:v1.0

* *問題描述:在網際網路中使用的ip位址佔4位元組,可以用四段法表示,每段值的範圍為0-255,中間用「.」隔開,例如202.194.116.97。其實,也可以看看乙個有4位元組的無符號整型值3401741409。 現設計乙個ip位址類,用於儲存ip位址,並實施在ip位址上的一些操作

*輸入描述:

*程式輸出:

*/

#include using namespace std;

class ip

; unsigned int address;

};public:

ip(int=0,int=0,int=0,int=0);

void showip();

bool samesubnet(const ip &ip, const ip &mark);

char whatkind();

};ip::ip(int s0,int s1,int s2,int s3)

void ip::showip()

{

cout執行結果:

第六周專案三 IP位址類

完成日期 20164月7日 版本號 v1.0 問題描述 在網際網路中使用的ip位址佔4位元組,可以用四段法表示,每段值的範圍為0 255,中間用 隔開,例如202.194.116.97.其實,也可以看看乙個有4位元組的無符號整形值3401741409.現設計乙個ip位址類,用於儲存ip位址,並實施在...

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