Pinging an IP ? [Solved]
Back with another question. 
I want to ping 8.8.8.8 (google DNS) to assure I am online, but I am not positive of the commands / syntax of the "if" statement. I'm aware this isn't correct, but what I mean is:
pingSuccess is not a variable in my code, I'm not sure if I need one or there is a command to detect true/false from the closest command? Then I can code the rest. Yeah, it's simple. Yeah, I could do it in a batch file. But there's no harm in learning new syntax / commands.
Don't need full source codes, since I didn't tell you what this is for. It's a surprise.
EDIT: Here's my new source:
EDIT2: I still need to have an if statement that will execute commands if successfully pinged the user-inputted IP.

I want to ping 8.8.8.8 (google DNS) to assure I am online, but I am not positive of the commands / syntax of the "if" statement. I'm aware this isn't correct, but what I mean is:
Code:
int main()
{
system("ping 8.8.8.8");
if(pingSuccess == 1) {do this}
}
Don't need full source codes, since I didn't tell you what this is for. It's a surprise.

EDIT: Here's my new source:
Code:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
static string host;
static string ping_again;
void _doPing()
{
system("cls");
cout << "Enter the IP you wish to ping: ";
cin >> host;
system (("ping " + host).c_str());
cout << endl;
cout << "(Y)es (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()
{
ping();
return(0);
}


I meant for, and this is exactly what I needed. I'll mess around until I get everything right. /req close