The user enters numbers and brackets separated by spaces (there is always a closed one for each open bracket). For example, 18 7 ( 5 3 ) 2 . The algorithm should make a normal equation from this set and give out 18=7+(5-3)*2 There is only +, -, *, =, other actions are not used. The procedure in the equation is not standard - at the beginning, what is in brackets, and then from left to right. For example, 3 + 3 * 5 would be 30.

Language is not important, the main thing is to invent the algorithm itself. Does anyone have any ideas?

  • one
    Busting what other ideas could be there ... - Akina
  • Yes, I already thought about busting, but this is somehow not interesting. - Sergey Koreshkov
  • Have you come up with it yourself or is there a task? - Sergey
  • @Igor is most likely important, nevertheless it is necessary "The algorithm should make a normal equation out of this set" - Stepan Kasyanenko
  • = It can stand anywhere, but there must be a correct equation on both sides. - Sergey Koreshkov

1 answer 1

Java

 { int array [] = /*как нибудь забьешь туда числа*/ string a = (array[0] + "=" + array[1] + "+ (" + array[2] + "+" + array[3] + " )" + "*" +array[4]); System.out.print(a); } 

The simplest In the future, make a generator, and so you can shove everything into the object.