On this site, use code tags:
[code]
//Your code Here
[/code]
|
If you don't have a compiler, you can use an online one:
https://www.onlinegdb.com/
or
http://cpp.sh/
MAKE SURE to have your own comfortable coding environment - You NEED it. Use something like Visual Studio, it's free and amazing.
When coding a program, start off by breaking it into parts:
• Program rolls a dice, generates a random number between 1 and 6
• Counts how many times the dice is rolled until it gets a 6
• The program will then ask the user if they want to continue
• The program will display the average number of rolls needed to get a six, and the number of sixes that average was based on
Do them ONE at a time. Once you've got one functional, go to the next one. The code provided for one already does the first condition. It creates a random number between 1 and 6, and saves it for you in the variable "roll".
Now, you should use a loop as you have (a for loop is the best here but either one can be used), put that random number generator into a loop and let it loop until "roll" is equal to 6. The issue with your code is that you did this, but you're not checking of "roll" is equal to 6, instead you're MAKING roll equal 6. You're using the "=" operator which assigns, what you want to use is "==", which will CHECK if "roll" and 6 are the same value.