i'm supposed to write a program that simulates cointoss. for each toss the program should print heads or tails and it would toss 100 times and counts the number off times each side of the coin appears. it should also call a seperate function 'flip' that takes no argument and returns 0 for tails and 1 for heads. pease help meeee its due today. this is what i have so far:
i keep getting errors when i execute it and i don't get what i want. also it doesn't call the flip function that gives me 0 for tail and 1 for heads. i need to know if the code is correct.
You have forgotten to use the return value of flip(). If you did this if (flip()==1) . I think you would be a lot better than looking at your loop count varible.
If really helps lots to run you code on paper, with a list of variables when the code is small and you are beginning. They you would see why you only get one head.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.