Hi,
I am creating an console ap that will ask user to input an ip address and then its gonna ping it,
and I am stuck at the point of the ping command because i dont know how can i add the user veriable to the ping command itself.
Here is the code.
Code:
#include <stdlib.h>
using namespace std;
int main()
{
system("cls");
string ipaddress = "a";
cout<<"Input an IP address or a name of a host:\n";
cin >> ipaddress;
system("ping ", ipaddress); //I also tried system("ping " & ipaddress);
cin.get();
}
I ever tried something like this:
Code:
#include <stdlib.h>
using namespace std;
int main()
{
system("cls");
string ipaddress = "a";
cout<<"Input an IP address or a name of a host:\n";
cin >> ipaddress;
ipaddress = "ping ", ipadress;
system(ipaddress);
cin.get();
}
If i could get some help on this it be very nice couse this was bugging me for quite a while and I have no clue what the solution to this might be.