Thread: ping in c++
View Single Post
  #6 (permalink)  
Old June 18th, 2007, 05:32 AM
TotcoS TotcoS is offline
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TotcoS Send a message via MSN to TotcoS Send a message via Yahoo to TotcoS
Default

Here you go..
Code:
#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

static string host;
static string ping_again;

void ping()
{
     system("cls");
     cout << "Host: ";
     cin >> host;
     system (("ping " + host).c_str());
     cout << endl;
     cout << "(Y)es or (N)o\n\n";
     cout << "Ping another host: ";
     cin >> ping_again;
     if (ping_again == "Y" || ping_again == "y")
     {
     system("cls");
     ping();
     }
     else if (ping_again == "N" || ping_again == "n")
     {
     system("exit");
     }
}

int main()
{
     SetConsoleTitle("Ping in C++ by TotcoS");
     ping();

     return(0);
}
Happy Coding,
Scott Stauffer aka TotcoS of BlackHat-Forums.
Reply With Quote