```
double Node::ConvertChar(char key[])
{
double value;
value=atof(key);
return value;
}
void Node::ConvertFormula(string formula,int resistor,vector <Resistor> &Res,vector <double> &OpArray){
int Operator=resistor-2;
resistor=resistor-1;
int length=formula.length();
int j=length-4;
double resistance;
while(length>0)
{
char temp[3]; int x=1;
for(int i=2;i>=0;i--)
{
temp[i]=formula[length-x];
x++;
}
resistance=ConvertChar(temp);
Res[resistor].SetResistance(resistance);
resistor--;
while(j>0)
{
if(formula[j]=='+')
{
OpArray[Operator]=-1.0;
}else
{
OpArray[Operator]=-2.0;
}
Operator--;
j=j-4;
}
length=length-4;
}
}
Node* Node::StoreFormula(int Tcomponent,vector <Resistor> &Res,vector <double> &OpArray,int Operator) {
node* root=NULL; int x=Operator-1;
for(int i=Tcomponent;i>0;i--)
{
if(i%2==0)
{
double OperatorValue=OpArray[x];
root=insertNode(root,OperatorValue);
x--;
}else
{
root=insertNode(root,Res[Operator].getResistance());
Operator--;
}
}
return root;
}
Node* Node::GenerateRandomCircuit(Node* root,vector <Resistor>&Res,vector <double>&OpArray,int& resistor,int& Operator) {
resistor=RandomResistor();
Operator=resistor-1;
Res.resize(resistor);
OpArray.resize(Operator);
SetRandomResistance(resistor,Res,Operator);
SetOperator(OpArray,Operator);
int Tcomponent=Operator+resistor;
root=StoreFormula(Tcomponent,Res,OpArray,Operator);
return root;
}
Node* Node::EnterFormula(Node* root,vector <Resistor>&Res,vector <double>&OpArray,int& resistor,int& Operator) {
int length; string formula; int i;
int Tcomponent;
cout<<"Enter circuit formula : ";
cin>>formula;
length=formula.length();
Operator=0; i=length-4;
while(i>0)
{
if(formula[i]=='+'||'/')
{
Operator++;
}
i=i-4;
}
resistor=(length-Operator)/3;
Tcomponent=Operator+resistor;
Res.resize(resistor);
OpArray.resize(Operator);
ConvertFormula(formula,resistor,Res,OpArray);
root=StoreFormula(Tcomponent,Res,OpArray,Operator);
return root;
}
```

**Can anyone explain the coding? Because i am having problem to understand it and by the way this program is about binary tree**