Consider initializing your random number generator at the beginning of your program:
#include <ctime>
srand(time(0));
Your logic is totally weird here:
toss--;
counter++;
toss = rand() % 1;
It's useless to deincrement toss when it gets assigned the random number 2 statements later. And rand() % 1 won't work, because the remainder of anything divided by 1 will be 0 (except for decimals, but you're assigning to an integer so any fractions are thrown away).
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Also, your coinToss() function needs to be formatted properly. It'll only take you 30 seconds... ;)
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
So where is the function that has no input and no return value and upon calling it asks the user how many coin tosses and then simulates that number of coin tosses?
cscgal
The Queen of DaniWeb
19,424 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
Not only do you resurrect an old thread, you don't even know what language you're dealing with. This is a C++ forum, not BASIC. Random numbers are integers.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944