Is your executable by any chance called "ping"/"ping.exe"?
By the way, system() won't recognize the string "ip" as a variable within your program. What you're doing has the exact same effect as taking the console and typing ping ip
An IP address is a 32-bit integer, normally written as 0.0.0.0-255.255.255.255. While the binary representation does in some systems fit into an int, asking the user to manually perform the conversions is nothing short of retarded.