### problems

this is my assignment and below is the my code where am I wrong?....Write a program that simulates the tossing of 3 die and computes the probability of obtaining each of the values 3 to 18. Your program should ask the user how many rolls to simulate, and then perform the simulation and report the results. Include an appropriate srand() function so you get different results each time.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243`` `````` #include "stdafx.h" #include using namespace std; #include #include #include int pairofdiceroll(); int main() //int _tmain(int argc, _TCHAR* argv[]) { int rollarray[11]={0}; int numrolls; int i; srand(static_cast(time(NULL))); cout << " How many roll?"; cin >> numrolls; for (i=0; i,numrolls; i++) { int theRoll; theRoll= pairofdiceroll(); cout << theRoll << " "; rollarray[ theRoll-2]++; } cout << "\nResults\n"; for(i=0; i<11; i++) { cout << showpoint << fixed << setprecision(2); cout << setw(10) << rollarray[i] << " " << setw(2) << i+2 << "'s were rolled(" << (static_cast(rollarray[i])/numrolls)*100 << "%)\n"; } return 0; } int pairofdiceroll() { int result; int d1 = rand()%6+1; int d2 = rand()%6+1; int d3 = rand()%6+1; result = d1+d2+d3; return result; } ``````
Look at your first for statement. The actual argument, in parenthesis... I think you'll be able to spot what's wrong. At least, I'd rather not have to spell it out so plainly.
thanks lol
Topic archived. No new replies allowed.