There's three things wrong with this:
Line 30:
for(counter>0; counter<=4; counter++)
The first argument in a for loop should be an assignment - you have included a comparison. Effectively, you could completely remove the first argument with no effect on the code.
Line 85-86:
You forget to reset the value of rightposition and rightnumber, they should be reset each time just before you increment them.
Line 86:
You have a for loop that results in you outputting the text four times:
MasterMind (For checking: 5 1 3 6)
Enter four digits (1-6) seperated by a space
--------------------------------------------
Round 1:
Enter Guess: 1 2 3 4
O #
--------------------------------------------
O O # #
--------------------------------------------
--------------------------------------------
--------------------------------------------
|
As you can see, I had one number in the right position (the 3) and one right number not in the right position (1).
Second time it looped, it increaced both values by 1, thus displaying OO##.
Third time the counter hit three right numbers and three right positions, which doesn't match any of your output conditions.
Etcetera etcetera etcetera.
Any more guesses would add (because you don't reset the rightnumber and rightposition values) four (because of the for loop) times what they should.