we check whether the given IP address is valid or not using this algorithm in C++. In this project, we used IPv4 addresses, which consist of four decimal numbers ranging from 0 to 255.
An IP address allows the computers to send and receive information. In this algorithm we will only focus on a particular type of IP address. we take input as IP address in a string and then we divide the string according to the positions of '.' and then check all those sub-strings whether it is in the required range(0 to 255). we should also check that there are no leading zeroes(eg: "00", "001").some IP addresses contain alphabets as well which may be correct, this algorithm is going to show that as wrong IP address as it is designed only for numericals