I am new to C#, and don't have a big scale of options to do specific tasks. But still have the challenge to create a scientific calculator.
What I want to get is separating a parent, with start and end tag from a child. Also count how many parents and the order which parent is first and then and then and so on.
With the content of each child. After that I calculate the results of each child (if there is any) and create the content of the parent which get calculated too.
for example:
string somestring = "5+5+(3+1+(0+1))+5+5+(3+1+(0+1))";
and from the calculated result (example is in javascript but I want it in C#):
result =
[{
"parent" : "content of parent",
"child" : ["content of child","content of child"]
},
{
"parent" : "content of parent",
"child" :["content of child","content of child","content of child"]
}];
this way I can :
- count length of 'result' array to get number of parents.
- count length of 'child' array to get number of children.
- get the content of the element by pointing to the array index number.
It doesn't have to be in this type of array, but some way to do the things above.
Thanks for your time and help!