- C++14 ISO C++ language standard
- There is a file called input.txt, update it with your corresponding LAN topology connection.
- Execute the exe file or run the cpp file using Codeblocks IDE.
- The output will be saved in the output.txt file.
- The tutorial[Link] is availabe for better understanding.
The first input line contains a single integer n — the number of connections in the network. Then n lines contain 2 string or 2 string & 1 integer each, each integer denotes number of host. The last line indicates starting address. PC connection name must have 'PC' substring. Router - PC connection input can be in any order, like R0 PC1 or PC1 R0. See this tutorial - Generating Addressing Table and Router Configuration Commands for better understanding.
Pring the addressing table and router configuration commands.
Test case 1:
5
R0 PC1 40
R0 R1
R0 R2
R1 PC0 80
R2 PC2 20
192.168.1.0/24
Note: Here 5 is the number of connections. There following 5 lines contains connections. For example, router R0 is connected with PC1 and the network will have 40 hosts.
- Switch is not considered. If there is a switch between router and PC just ignore it.