assistance with ping command

#include <iostream>
using namespace std;
int main()
{
int ip;
cout << "Please Enter An address \n";
cin >> ip;

system ("ping ip");
cin.get ();
return 0;
}


when i compile my code and run it i am able to get the "please enter an address" to come up but once i enter a number/ipaddress it comes up again

could i please have some help?
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.
Topic archived. No new replies allowed.