I made a hangman game; it runs fine with no errors. I used a while loop, with a nested if statement, to give the player ten guesses. I want the loop to break if they completely spell the word. I am using a dash counter to keep track of the numbers of letters left over; when it hits zero, then the word is completely spelled.
The thing is though, my teacher is not letting me use break statements. I don't see any other ways to break the while loop. Thoughts?
int main()
{
    printf("Your Word Is: %s", &dash);
    //printf("\nWord: %c", &dash);
    loopcount = 10;
    count = 1;
    while ((count <= loopcount))
    {
        printf("\n\nPick a letter to guess: ");
        scanf(" %c", &guess);
        printf("\n\nYour Guess Was %c. ", guess);
        count = count + 1;
        if (guess == 'c')
        {
            dash[0] = 'c';
            printf("\n\n %s", dash);
        } else if (guess == 'o')
        {
            dash[1] = 'o';
            printf("\n\n %s", dash);
        } else if (guess == 'd')
        {
            dash[2] = 'd';
            printf("\n\n %s", dash);
        } else if (guess == 'i')
        {
            dash[3] = 'i';
            printf("\n\n %s", dash);
        } else if (guess == 'n')
        {
            dash[4] = 'n';
            printf("\n\n %s", dash);
        } else if (guess == 'g')
        {
            dash[5] = 'g';
            printf("\n\n %s", dash);
        } else
        {
            printf("That Letter Is Not Apart of this Word");
        }
    
        printf("\n\nYou are at Guess Number %d, Your word is at %s",
              count, dash);
    
        dashcount = 0;
        for (i = 0; dash[i]; i++)
        {
            if (dash[i] == '-')
            {
                dashcount++;
            }
        }
    }
    if (dashcount > 0)
    {
        printf("\n");
    } else
    {
        printf("\n\n\nI'm Sorry, the word was %s.", word);
    }
    printf("\n\n");
    return 0;
}
 
     
    