C++ 写一个带界面的小程序,长得好像计算器一样,按多少显示多少。已有模板,只需完成其中几个地方

要求:creating a small program that looks like the keypad of a calculator. You should try to recreate the screenshot on the next page. For reference, the frame is 300-by-300 pixels and the number (and dot) buttons are in a separate panel. Think carefully about the types of layout managers to use for each section of the frame. The accumulator label should begin with the text “0”. For the accumulator label, I use the following code to make the font larger and right-aligned:label.setFont(new Font("Arial", Font.PLAIN, 40)); label.setHorizontalAlignment(SwingConstants.RIGHT);Functional Requirements You also have a number of functional requirements. Whenever you press a key, you should append the label of that key onto the accumulator label. This allows you to type numbers. However, you should be aware of several things:Leading zeroes should be ignored. If your first click is the “2” button, the accumulator should read “2”, not “02”.You should only allow one dot to be entered. A second press of the button should have no observable effectIf you press “C” button, the number should be cleared and be replaced with “0”.It is up to you to figure out how to elegantly handle these cases.

第1个回答  2016-11-15
你这个是JAVA好吧?
相似回答