# Falling disk problem in C/C++ - Any ideas??

Discussion in 'C++' started by H'Okay, Apr 18, 2007.

1. ### H'OkayNew Member

Joined:
Apr 18, 2007
Messages:
2
0
Trophy Points:
0
Occupation:
Student
Location:
Crowborough
Hey all, my first post! Anyway I'm having trouble figuring out how to implement this problem. The official blurb is below:

/*This coursework will require the use of random numbers to generate a distribution. It is essentially a simple model for a scattering process (physics) or a distribution (mathematics). The elementary step of this process is described first:

Consider a 2 dimensional problem of a ball falling on a fixed round obstacle precisely at the axis of symmetry. The probability of going to the left or the right is 0.5. If we count the disks falling to the left we will get exactly ½ of the number of ‘thrown’ disks; the other half is collected in the bin labelled ‘gone to the right’.
We can now take such a unit and connect several in series. This process can be easily extended to include more layers.

Write a computer programme in C that will model the scattering process with the use of random numbers. The programme should be able to handle configurations up to 15, with the number of the configuration being specified at the running stage. As input the user should also specify the number of disks falling through the array of scattering centres. The desired output is the number of disks in each bin, and the ratio of disks in each bin (that is the ratio of disks in the bin / total number of falling disks).

Compare the statistical result of your programme (which is an example of a Monte Carlo programme) with the analytical result (which you are asked to obtain). Present these in your write-up. */

So far I have one rough idea of how to proceed but am curious as to how any experienced programmers would do this (since I am officially a noob). I can't seem to attach the documentation itself which has pictures to further explain the problem. I can't even attach the basic jpegs either. Don't hesitate to contact me if you would like to see these & help me out ! Many thanks in advance

Oh, one thing I should add; I have only learnt basic commands, i.e. if loops & for loops & that's more or less it

2. ### DaWeiNew Member

Joined:
Dec 6, 2006
Messages:
835
5
Trophy Points:
0
Occupation:
Semi-retired EE
Location:
Texan now in Central NY
http://www.daweidesigns.com
Sounds like a pachinko machine. I would suggest worrying less about the default font sizes and colors on the forum, and more about your assignment. Make some attempt to code a solution. Return to the forum with questions, when it fails. Be sure and read the "Before you make a query" thread, so that you have some idea how to properly ask a question, retain the formatting of your code, etc. etc.

Joined:
Apr 18, 2007
Messages:
2