I have to do a program calculating the total resistance of a ladder network.

I've done the array and what I think is the equation for it. There are no parse errors when I compile it but the program stops after the values have been inputted?

Any ideas?

heres what I have:

#include<iostream.h>

#include<fstream.h>

#include"Array.h"

#include"Text.h"

using namespace std;

int main()

{

Array<double> res;

int NoRes;

double ResVal;

cout << "Welcome to the equivalent resistance calculator." << endl;

cout << "enter the number of resistors in the circuit (must be EVEN number): ";

cin >> NoRes;

res.setSize(NoRes);

cout << endl;

double value;

for (int n=0; n < res.size(); n++)

{

cout << "enter value for resistor " << n+1 << " in ohms : ";

cin >> value;

res(n) = value;

}

ResVal = res(NoRes-1);

for (int i = NoRes-2; i>0; i=i-2)

{

ResVal=ResVal+res(i);

ResVal= (ResVal*res(i-1) / (ResVal + res(i-1))) ;

}

ResVal=ResVal+res(0);

return 0;

}