how to update an answer?

for example:

//key in: i=8;
for(n=i, n>=2,n--)
ZT8=0.099 //let said Ztn=ZT8
ZT7=(ZT8+5.5+j8.3) //let said Ztn now become ZT7
ZT6=(ZT7+6.8+j8.9) //and now Ztn become ZT6

how i update the value ZTn? (from value calculated before?)



part of my source code:


cout<<"please key in how many tower involve in calculation (in number)"<<endl<<endl;
cin>>i;
cout<<endl<<i<<"tower are involve in calculation"<<endl<<endl;



for(m=i-1,n=i; m>=1, n>=2; m--, n--)
{


cout<<"to calculate overhead earth wire self impedance between tower "<<m<<"and"<<n<<endl<<"we need information of distance between tower "<<m<<"and "<<n<<endl;
cout<<"\n\nD"<<m<<n<<"is?"<<endl;
cin>>Dmn;

complex<float>Zgw = complex<float>(1.66e-4,3.26e-4);
complex<float>Zsmn = complex<float>(Zgw*Dmn);


cout<<"Zs"<<m<<n<<"="<<Zsmn<<endl<<endl;

if(n==i)
{
Ztn = (Rs*Rt)/(Rs+Rt);
cout<<"ZT"<<n<<"="<<Ztn<<endl<<endl;
complex<float>(Ztn,0);
goto calculation;

}

if(n!=i)
{

complex<float>Ztn = Ztm;//here, how to make Ztn = Ztm calculated before when n==i??
cout<<"ZT"<<n<<"="<<Ztn<<endl<<endl;
goto calculation;

}

calculation:
{

complex<float>Ztr = complex<float>(Ztn+Zsmn);
complex<float>Ztm = complex<float>((Ztr*Rt)/(Ztr+Rt));
cout<<"ZT"<<m<<"="<<Ztm<<endl<<endl;

}




hope can get some answer from here..

thank you very much..
Last edited on
You could create an array named ZT and store values in it.
i had found the problem!!

i had accidently defined the Ztm twice..

anywhere, thanks!!
Topic archived. No new replies allowed.