I have an urgent assignment to write a c++ program and I lack time to learn the whole language. Is there anyone willing to give a detailed outline enabling me to write the program myself? I simplified the assignment and will describe it in terms of algorithms.

The program describes the partition of heat along a bar, consisting of 100 points. At the first time t=1, the temperature of the first point is 50 (degrees) and the temperature of the other points is 0.

header file
The header file has to declare the array temp, an array with 100 members, which are floats, so that this array can be used in several cpp source files.

cpp file
input: tf , the final temperature
output: the array of dimension 100, containing the temperatures of the 100 points of the bar at tf

This algorithm will work on members of 2 succeeding arrays with 100 members: those containing the 100 temperatures of time t-1 and time t, where t is an integer, because the algorithm applies once in a second (1<=t<=tf). By temp(x,t), a single member of the array, I will mean the temperature of the point at position x (1<=x<=100 or 0<=x<=99 : this depends on the program).

for(t=1, t<=tf, t++)
if ((x==1)&&(t==1)) temp(1,1)=50

if((x==1)&&(t!=1)) temp(1,t)=3/4*temp(1,t-1)+1/4*temp(2,t-1)

if((x!=1)&&(t==1)) temp(x,1)=0

if(1<x<100) temp(x,t)=1/2*temp(x,t-1)+1/4*temp(x-1,t-1)+1/4*temp(x+1,t+1)

if(x==100) temp(100,t)=1/2*temp(100,t-1)+1/4*temp(99,t-1)

If tf=1, the 100 members array temp(1)={50 , 0,………….,0}.
If tf=2, the 100 members array temp(2)=={3/4*50 , 1/4*50 , 0,…………0}
and so on…

extra remarks
You have seen that I think the main of the program will be a for loop in time t. Each part of this loop will produce an array of dimension 100. In order to calculate the array temp(t) the program only has to know the array(t-1). Each time the time loop proceeds the array temp(t-1) in the memory storage has to be replaced ( since memory space is limited!) by the array temp(t), to calculate the array temp(t+1), until the array temp(tf), the output, is reached.
Then there is still something superfluous about this program. If t<100, the elements of the array temp(t) on positions x>t (if 1<=x<=100) or x>=t (if 0<=x<=99) are 0. I do not think this to be crucial, though.


No, we will not do your assignment. Give it a shot and we'll certainly help when you have a problem. Or ask specific questions about how to get started.