Okay, since this is obviously homework, let me just ask some questions.
You specify that write2 = 1, but what about the other variables in that line?
When are the read1count, write1count, etc., variables ever set to anything? Never. So what are the switch statements for? (Well, write2count is but still...) Even had you managed to get them all set to 0, since all the switch statements are outside of any loop (main is only executed once...) all you would manage to do is increment all these values once, then exit the program.
What exactly are you trying to accomplish with your for loop? Currently all it does is set coin to a number between 0 and 4, then sets coin to either 1 or garbage, repeats 5000 times, then throws coin away.
While and if are not interchangeable. While should be used like this:
1 2 3
|
while(i >= 20){
i++;
}
|
or like this:
1 2 3 4 5 6
|
do{
if(i <20)
i++;
else
break;
}while(true);
|
So, as programmed, it wouldn't ever output anything.
Oh, and take that comma out of the 5000. It compiles, but doesn't do what you expect.