d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help
Add Reply New Topic New Poll
Member
Posts: 3
Joined: Jan 10 2016
Gold: 0.00
Jan 10 2016 12:33pm
How to write a program that assists in the study of coin flips.the program should ask the user to flip a coin and enter the result.The number of coin flips should be entered at the start.When complete , the program should display the number of heads and tails.program output should look similar to:
How many flips to analyze? 5

Flip coin and enter result (H or T ) #1 : H
Flip coin and enter result (H or T ) #2 : H
Flip coin and enter result (H or T ) #3 : T
Flip coin and enter result (H or T ) #4 : H
Flip coin and enter result (H or T ) #5 : T

This post was edited by RandyMillholland on Jan 10 2016 12:42pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 10 2016 12:35pm
what code do you already have and what do you need help with?
Member
Posts: 3
Joined: Jan 10 2016
Gold: 0.00
Jan 10 2016 12:38pm
Example of pseudocode. im not too good at formatting the code though.

This post was edited by RandyMillholland on Jan 10 2016 12:40pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 10 2016 12:42pm
Quote (RandyMillholland @ Jan 10 2016 01:38pm)
Well im trying to figure out what to do im a beginner and im trying to make a do while loop and make length=0.. count to 1 while (count is less than or equal to) C++ but im not good at how to format the code.


why are you using a do while loop?

http://www.tutorialspoint.com/cplusplus/cpp_for_loop.htm
Member
Posts: 3
Joined: Jan 10 2016
Gold: 0.00
Jan 10 2016 12:43pm
I edited the question to make more sense. i didnt mean do while loop... im using pseudocode
Member
Posts: 226
Joined: Jan 21 2016
Gold: 0.00
Jan 21 2016 03:17am
Quote (RandyMillholland @ Jan 10 2016 10:33am)
How to write a program that assists in the study of coin flips.the program should ask the user to flip a coin and enter the result.The number of coin flips should be entered at the start.When complete , the program should display the number of heads and tails.program output should look similar to:
How many flips to analyze? 5

Flip coin and enter result (H or T ) #1 : H
Flip coin and enter result (H or T ) #2 : H
Flip coin and enter result (H or T ) #3 : T
Flip coin and enter result (H or T ) #4 : H
Flip coin and enter result (H or T ) #5 : T


variable for heads
variable for tails
variable for number of fliips

increment what side the coin landed when the user tells you
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll