在我的c ++代码中,我想反复获取用户的输入,直到用户输入“0”作为输入。但循环根本不起作用。 这是我的代码......
class MyStaticMplCanvas(MyMplCanvas):
"""Simple canvas with a rectangle plot."""
def compute_initial_figure(self):
x = 10
y = 20
width = 10
height = 20
rect = mpatches.Rectangle((x, y), width, height)
self.axes.add_patch(rect)
# Change limits so we can see rect
self.axes.set_xlim((0, 50))
self.axes.set_ylim((0, 50))
答案 0 :(得分:1)
为option
变量分配初始值,使其默认情况下未定义,并将do-while条件更改为while (option != 0)
。
如果option
等于零,您当前的代码将会循环播放。