SIMPLE HANGMAC [C++]

#include <iostream>
#include <string>
using namespace std;

void printHangMac(int);

void main()
{
    string toBeGuessed, guess;
    int i, numErrors = 0;

    cout << "\n\nEnter the string to be guessed: ";
    fflush(stdin); //used to clear the buffer
    getline(cin, toBeGuessed);
   
    system("cls");

    string asterisks(toBeGuessed.length(), '*'); //replace all characters with asterisks

    for(i = 0 ; i < toBeGuessed.length() ; i++)
    {
        if(toBeGuessed.at(i)==' ')
        {
            asterisks.replace(i, 1, " "); //replace spaces
        }
    }

    do
    {
        cout << endl << asterisks;

        cout << "\n\nGive me a letter: ";

        fflush(stdin);
        getline(cin, guess);       

        for(i = 0 ; i < toBeGuessed.length() ; i++)
        {
            if(toBeGuessed.at(i)==guess.at(0))
            {
                asterisks.replace(i, 1, guess); //if found
            }       
        }
       
        if( toBeGuessed.find(guess, 0)==-1 )
        {
            numErrors++;       
            printHangMac(numErrors);
        }

    } while(numErrors < 6 && (asterisks.find("*",0) != -1) );


    if(numErrors == 6)
    {
        cout << "\n\nLoser. Moron. Game ovah.";
    }
    else
    {
        cout << "\n\nWinnder. Not a moron.";
    }

    cout << endl << endl;
}

void printHangMac(int errors)
{
    string mac[6];
    mac[0] = "   O\n";
    mac[1] = "  /";
    mac[2] = "|";
    mac[3] = "\\\n";
    mac[4] = "  /";
    mac[5] = " \\\n";

    for(int j = 0 ; j < errors ; j++ )
    {
        cout << mac[j];
    }

    cout << endl;
}