This code requests the user to enter an IP address and a subnet mask, both in decimal number, returning both of them in addition to the subnet and the broadcast addresses, everything in both decimal and binary numbers. This way, the following example is possible:
Digite o IP: 192.168.0.2
Digite a máscara de subrede: 255.255.255.89
IP: 192.168.0.2
Binário: 11000000.10101000.00000000.00000010
Máscara: 255.255.255.89
Binário: 11111111.11111111.11111111.01011001
Subrede: 192.168.0.0
Binário: 11000000.10101000.00000000.10100110
Besides each line of code, there's the explanation in Brazilian Portuguese of the logic used and what is being done on each function.
Work requested by the professors of Programming I and Computer Networks for the Internet, Alessandra Aguiar Vilarinho and Gilmar Luiz Vassoler at the Instituto Federal de Educação, Ciência e Tecnologia do Espírito Santo - Campus Serra. November, 2017.
Members of the group: Éllen Neves, Maria Gabriela Tavares, Pedro Caio Miranda and Sidenir Junior.
Bibliography: this video and professors in the programming and networking subjects.