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!!

Recommended Answers

All 8 Replies

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

I need the full code of how to do it

You would never get full code here.
Google is your friend. Here is a nice article here on Daniweb about generating Random Numbers:http://www.daniweb.com/forums/thread1769.html

Off-Topic
"Laughter Laughter, Laughing at my cries"

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.

Read a tutorial about C++ ...
There are many floating around on the internet ...

But why cant you just give me the code?

commented: Get real, bozo. Stop begging and read your **** book. -3
commented: if you cant generate a simple random number then you really are on the wrong course -7
commented: what they said -3

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.

commented: Well said +29
commented: Well said :) +1

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).

commented: The granite fist in the velvet glove comes down on another dead-end "gimme the answer" thread +29
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.