Hey !! Guys .. please help me to solve this problem in c++ .. please send me its coding ... The question is 👇👇👇👇👇.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Hey !! Guys .. please help me to solve this problem in c++ .. please send me its coding ... The question is 👇👇👇👇👇....

write a program that simulates the rolling dice of two dice. the sum of the two values should then be calculated. use a 1- d array to tally the number of times each possible sum appear print the result in tabular format...

26th May 2017, 10:20 AM
Louis
Louis - avatar
7 Answers
+ 2
Here's what I coded so far: #include <iostream>#include<iomanip>using namespace std;int main(){ const int arraysize = 13; int counter[13], sum=0; // init counter for(int i=0; i<13; i++) counter[i] = 0; int die1; int die2; for ( int roll1 = 0; roll1 <=36000; roll1++ ) { die1 = 1 + rand() % 6; die2 = 1 + rand() % 6; counter[die1+die2]++; } cout<<"sum of Faces"<<setw(13)<<"Frequency"<<endl; for(int face=2; face<arraysize;face++) { cout<<setw(7)<<face<<setw(13)<<counter[face]<< endl; sum += counter[face]; } cout << "sum: " << sum; return 0;} I think this will help u. thanks
27th May 2017, 1:25 AM
nitesh kumar
nitesh kumar - avatar
+ 17
If you won't lift a finger to help yourself, you can't expect anyone else to come to your aid. 😃
26th May 2017, 10:23 AM
Jobelle
Jobelle - avatar
+ 6
ok
27th May 2017, 1:39 AM
Louis
Louis - avatar
+ 5
that's your answer .... 😒 if you don't know say it properly ... don't give this type of comment on my question ... I am the beginner in c++ ... understand ..
26th May 2017, 10:30 AM
Louis
Louis - avatar
+ 3
opps , sorry , can u please correct it's order.
27th May 2017, 1:27 AM
nitesh kumar
nitesh kumar - avatar
+ 2
hey, anyone will be my friend...?
27th May 2017, 6:53 AM
nitesh kumar
nitesh kumar - avatar
- 1
start with learning about rand()
26th May 2017, 12:03 PM
Daemo
Daemo - avatar