count - C++ divide a number to display at most 60 chars for different rolls of a dice -
i told roll die large number of times (a few thousand) @ first once record amount of times each value occurs , create makeshift histogram displaying x roll of number, e.g. rolling 3 1
's, 2 2
's, , 5 3
's might this:
1 xxx 2 xx 3 xxxxx
what trying find way divide x's @ 60 x's appear next number.
i have 2 instances, rolling single die recording 1-6, , 2 dice , recording sum in range 2-12 (11 values).
originally tried divide number of rolls 360 (6 possible values 1 die, 60 total xs) number of occurrences each x represented taking count roll (say rolled 1 2047 times) , dividing value if rolled dice 12000 times value of each x 12000/360 = 33 (the .3333 dropped due integer division) display 2047 / 33 x's yields 62.
anyone have better way this?
i tried 11*60 2 dice approach , way off.
this sounds homework, here's hint: figure out largest value need display is, use along maximum length display (60) ratio calculate length of each line of output.
Comments
Post a Comment