Hi i really need your help.First of all , think about we got two text files:
In numbers.txt we have:
4 5 3 2 10 1 45
In process.txt we have:
+ * /
We want to find 45 as a result with using 4 5 3 2 10 1 numbers and + * / to do sums.
Finally we want a txt file like output.txt
4 + (5 + (3 * (2 + (10/1)))) = 45 include the solution like this.
Each number can be used for one time and each process doesn't needed to be used but we cannot use anyother that not in process.txt.
note:if we cannot find the exact result , we have to find a near value.
Can you please help me about that? I'm totaly lost about this. Sorry for my bad english.
Homework hint: Use two Stacks, one holds numbers, one holds operators. Examine the Stacks when adding operators, to see if you can perform any merging of numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With