Strange output from Coin Flip program

I've written (tried to write) a coin flip simulation program is C++. The program compiles and runs in Code::Blocks but I'm getting some rather strange output. I'm hoping someone can shed some light on what I'm doing wrong. Thanks for your time and consideration.

Thank for the reply. Unfortunately, I'm still having problems. I took your advice and I initialized the variables "heads" and "tails" to zero. I also moved srand(time(NULL); and rand() % 2; outside the "for loop." Now my output looks this:

I've tried a few things (given the advice above)1. initialized the variables to zero2. moved the srand function outside of the for loop. I didn't know this. Thanks for the advice c student3. declared another variable count and set it equal to counter inside the for loop4. moved the cout statements out of the for loop (so you can get a total tally after once the for loop has completed)

1

C++

107,272 followers

About

Used in many types of software including music players, video games, and many large scale applications.