<? // Die <? hoort er dus niet bij!


#include <iostream>
#include <windows>
#include <string>
#include <stdio>
using namespace std;

int main() 
{ 
    int keuze; 
    char buffer[128];
    char adres[50];
    char janee;

    menu:
    system("cls");
    cout << "Welkom, bij het handige tooltje op te pingen!" << endl;
    cout << "1. Pingen" << endl;
    cout << "2. Stoppen\n" << endl; 
    cout << "Voer u keuzen in:\t" << endl;
    cin >> keuze;

    system("cls");
    if(keuze==1) { goto ping; }
    if(keuze==2) { goto exit; }
    else {
        cout << "Ongeldige invoer!" << endl;
        cerr << "Druk een toets in om veder te gaan" << endl;
        getchar();
        goto menu;
    }

    ping:
    cout << "Voer adres of ip in:\t" << endl;
    cin >> adres;
    sprintf(buffer, "ping %s", adres); 
    system(buffer);
    cout << "\nWil u nog een adres of ip pingen? [J/N]:\t " << endl;
    cin >> janee;

    system("cls");
    if(janee=='j') { goto ping; }
    else { goto exit; }

    exit:
    return 0;
}
