Hi I am having a problem in the sixth edition on starting out with C++ programming. I need the full code of how to do it cause I am getting errors and dont know what I am doing.

The question ask.Write a funtion named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads." If the random number is 2, the function should display "tails." Demonstrate the function in a program that asks the user how many times the coin should be tossed, and then simulates the tossing of the coin that number of times.

Ty for your help!!

9 Years
Discussion Span
Last Post by Narue

I need the full code of how to do it cause I am getting errors and dont know what I am doing.

Post what you have done so far


Try at least doing some effort, post the code you have so far ...
You'll never learn to program if you aren't writing programs yourself ...


Well I just joined this class late so I dont know what I am doing whatsoever so I needed this code to get my first grade.


But why cant you just give me the code?

Votes + Comments
what they said
if you cant generate a simple random number then you really are on the wrong course
Get real, bozo. Stop begging and read your **** book.

Because we already got our grades and passed the course. You can't pass using our work. You need to pass on your own work.

Votes + Comments
Well said :)
Well said

This thread is being closed due to violation of Daniweb's homework policy. Read our rules, try it yourself, and then create a new thread if you need help (help != handouts, by the way).

Votes + Comments
The granite fist in the velvet glove comes down on another dead-end "gimme the answer" thread
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.