#include#include#include#include#includeusing namespace std;class Nets{ public: string field = ““; vector Routers ; Nets(string ip) { field = ip; }; void add_router(string R) { Routers.push_back(R); };};class router{ public: map router_table; void update(string D string next) { router_table.insert(pair(Dnext)); };};map routers;map nets;main(){ router R1; R1.update(“10.0.0.0““out“); R1.update(“20.0.0.0““out“); R1.update(“30.0.0.0““20.0.0.9“); R1.update(“40.0.0.0““20.0.0.9“); router R2; R2.update(“10.0.0.0““20.0.0.7“); R2.update(“20.0.0.0““out“); R2.update(“30.0.0.0““out“); R2.update(“40.0.0.0““30.0.0.1“); router R3; R3.update(“10.0.0.0““30.0.0.2“); R3.update(“20.0.0.0““30.0.0.2“); R3.update(“30.0.0.0““out“); R3.update(“40.0.0.0““out“); routers.insert(pair(“R1“R1)); routers.insert(pair(“R2“R2)); routers.insert(pair(“R3“R3)); Nets n1(“10.0.0.0“); n1.add_router(“R1“); Nets n2(“20.0.0.0“); n2.add_router(“R1“); n2.add_router(“R2“); Nets n3(“30.0.0.0“); n3.add_router(“R2“); n3.add_router(“R3“); Nets n4(“40.0.0.0“); n4.add_router(“R3“); nets.insert(pair(“10“n1)); net
共有 条评论
评论
共有 条评论