operator 插入运算符使等式成立课程设计实验报告    设计程序在表达式“

2023-04-18139

插入运算符使等式成立课程设计实验报告

设计程序在表达式“=a”中左边的适当位置插入运算符“+”“-”或“*”,以使等式成立,列出所有可能情况。例如:当a=1000时,123+45-67+8-9=100。

在小学就遇到过这样的问题,只是那时遇到的这样的问题使很简单的,没有乘,并且现在的程序要求的使把所有符合条件的答案都选出来。所以可以考虑使用编写的程序来解决问题。

首先问题的左边是“”中插入适当的运算符,可以想象成有这九个人按顺序站着,然后在他们中间插入木板,木板分别为:“+”,“-”,“*”。把木板出入后就构成了一个表达式,然后通过特定的函数来筛选能够使等式成立的表达式,并输出。 - the was to in the " = a" on the left in the "" and"- "or"* ", in order to make was , the list of all . For : when a = 1000, 123 45-67 8-9 = 100. In is such a , but then such a that very , not by, and now the of all meet the of the are to. So using to solve the . The first left is "" , can this nine in , and then in the midst of them into board, board is: "","- ", "*". After the board in and out of an , and then the to can make , and .

标签: 实验报告