Thread: ping in c++
View Single Post
  #9 (permalink)  
Old November 19th, 2007, 03:38 PM
cisso cisso is offline
Registered User
Join Date: Nov 2007
Location: São Paulo, SP, Brazil.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cisso

Hi, i've tryed to put this code to run but it didn't compile.
my compiler didn't recognize the headers without .h , the "static strings" global declared and the "using namespace std". What compiler have you used?

quote:Originally posted by TotcoS
 Here you go..
#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

static string host;
static string ping_again;

void ping()
     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")
     else if (ping_again == "N" || ping_again == "n")

int main()
     SetConsoleTitle("Ping in C++ by TotcoS");
Happy Coding,
Scott Stauffer aka TotcoS of BlackHat-Forums.
Reply With Quote