I know how to scan subnets in c++...I also know how to find geo location (altough it's not 100%)...But does anyone have an idea how can i find the closest ip addresses to mine ?
Ex one neighbor is 100 meters from me and another one is 50 and if they are both connected to the internet, i should get the ip of the second which is 50 meters away from me.
Is there any possible way to implement this via programming language ?
Forget it. The structure of how ISPs work and allocate their IP's will make this entirely impossible in 99.999999999% of all cases.
The kind of geolocation by IP address you mention - by checking against databases of IP addresses, and by analyzing the route points of the IP - will work on a city level if you're lucky.
The only reliable means of geo-location down to a city borough or even block is a new set of technologies that for example query Wi-Fi hotspots around the user's computer, and compare them with a list of known Wi-Fi hotspots and their locations. See for example yesterday's question about Geolocation in HTML 5.
There is no way to triangulate other users' positions from that, and thank god for that!