當前位置:首頁 » 股票資訊 » nequal
擴展閱讀
漢鼎咨詢 2025-07-26 15:25:52
太平洋股票現在的價格 2025-07-26 15:20:40
58集團的股票價格 2025-07-26 15:20:00

nequal

發布時間: 2021-07-09 08:31:56

⑴ equals什麼意思

打開

equals

常見釋義

使等於

equals

n.同樣的人( equal的名詞復數 ); 相等的數量; 能與之比擬的東西; (地位、實力等)相同的人; 

v.比得上( equal的第三人稱單數 ); (質量等方面)趕得上; 與…相等或相同; 使(某物)等於; 

原型:equal

⑵ 簡單計算器的源代碼

package calculator;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.Rectangle;
import javax.swing.JButton;
import javax.swing.BorderFactory;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.SystemColor;
import java.awt.Color;

/**
* <p>Title:</p>
*
* <p>Description: 這個類用來實現一個簡單的計算器</p>
*
* <p>Copyright: Copyright (c) 2006年</p>
*
* <p>Company: </p>
*
* @author
* @version 1.0
*/
public class CalculatorFrame extends JFrame {

boolean flag = false;
String operand1;
String operand2;
double result;
String action;

BorderLayout borderLayout1 = new BorderLayout();
JTextField txtresult = new JTextField();
JButton btn1 = new JButton();
JButton btn2 = new JButton();
JButton btn3 = new JButton();
JButton btn4 = new JButton();
JButton btn5 = new JButton();
JButton btn6 = new JButton();
JButton btn7 = new JButton();
JButton btn8 = new JButton();
JButton btn9 = new JButton();
JButton btn0 = new JButton();
JButton btnplus = new JButton();
JButton btnminus = new JButton();
JButton btnjultiply = new JButton();
JButton btndivide = new JButton();
JButton btnclear = new JButton();
JButton btnequal = new JButton();

public CalculatorFrame() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}

private void jbInit() throws Exception {
getContentPane().setLayout(null);
txtresult.setBackground(SystemColor.WHITE);
txtresult.setBorder(BorderFactory.createLoweredBevelBorder());
txtresult.setDisabledTextColor(Color.black);
txtresult.setEditable(false);
txtresult.setHorizontalAlignment(JTextField.RIGHT);
txtresult.setBounds(new Rectangle(50, 50, 305, 25));
btn1.setBounds(new Rectangle(50, 200, 65, 30));
btn1.setBorder(BorderFactory.createRaisedBevelBorder());
btn1.setText("1");
btn1.addActionListener(new CalculatorFrame_btn1_actionAdapter(this));
btn2.setBounds(new Rectangle(130, 200, 65, 30));
btn2.setBorder(BorderFactory.createRaisedBevelBorder());
btn2.setText("2");
btn2.addActionListener(new CalculatorFrame_btn2_actionAdapter(this));
btn3.setBounds(new Rectangle(210, 200, 65, 30));
btn3.setBorder(BorderFactory.createRaisedBevelBorder());
btn3.setText("3");
btn3.addActionListener(new CalculatorFrame_btn3_actionAdapter(this));
btn4.setBounds(new Rectangle(50, 150, 65, 30));
btn4.setBorder(BorderFactory.createRaisedBevelBorder());
btn4.setText("4");
btn4.addActionListener(new CalculatorFrame_btn4_actionAdapter(this));
btn5.setBounds(new Rectangle(130, 150, 65, 30));
btn5.setBorder(BorderFactory.createRaisedBevelBorder());
btn5.setText("5");
btn5.addActionListener(new CalculatorFrame_btn5_actionAdapter(this));
btn6.setBounds(new Rectangle(210, 150, 65, 30));
btn6.setBorder(BorderFactory.createRaisedBevelBorder());
btn6.setText("6");
btn6.addActionListener(new CalculatorFrame_btn6_actionAdapter(this));
btn7.setBounds(new Rectangle(50, 100, 65, 30));
btn7.setBorder(BorderFactory.createRaisedBevelBorder());
btn7.setText("7");
btn7.addActionListener(new CalculatorFrame_btn7_actionAdapter(this));
btn8.setBounds(new Rectangle(130, 100, 65, 30));
btn8.setBorder(BorderFactory.createRaisedBevelBorder());
btn8.setText("8");
btn8.addActionListener(new CalculatorFrame_btn8_actionAdapter(this));
btn9.setBounds(new Rectangle(210, 100, 65, 30));
btn9.setBorder(BorderFactory.createRaisedBevelBorder());
btn9.setText("9");
btn9.addActionListener(new CalculatorFrame_btn9_actionAdapter(this));
btn0.setBounds(new Rectangle(50, 250, 65, 30));
btn0.setBorder(BorderFactory.createRaisedBevelBorder());
btn0.setText("0");
btn0.addActionListener(new CalculatorFrame_btn0_actionAdapter(this));
btnplus.setBounds(new Rectangle(290, 250, 65, 30));
btnplus.setBorder(BorderFactory.createRaisedBevelBorder());
btnplus.setText("+");
btnplus.addActionListener(new CalculatorFrame_btnplus_actionAdapter(this));
btnminus.setBounds(new Rectangle(290, 200, 65, 30));
btnminus.setBorder(BorderFactory.createRaisedBevelBorder());
btnminus.setText("-");
btnminus.addActionListener(new CalculatorFrame_btnminus_actionAdapter(this));
btnjultiply.setBounds(new Rectangle(290, 150, 65, 30));
btnjultiply.setBorder(BorderFactory.createRaisedBevelBorder());
btnjultiply.setText("*");
btnjultiply.addActionListener(new
CalculatorFrame_btnjultiply_actionAdapter(this));
btndivide.setBounds(new Rectangle(290, 100, 65, 30));
btndivide.setBorder(BorderFactory.createRaisedBevelBorder());
btndivide.setText("/");
btndivide.addActionListener(new CalculatorFrame_btndivide_actionAdapter(this));
btnclear.setBounds(new Rectangle(130, 250, 65, 30));
btnclear.setBorder(BorderFactory.createRaisedBevelBorder());
btnclear.setText("C");
btnclear.addActionListener(new CalculatorFrame_btnclear_actionAdapter(this));
btnequal.setBounds(new Rectangle(210, 250, 65, 30));
btnequal.setBorder(BorderFactory.createRaisedBevelBorder());
btnequal.setText("=");
btnequal.addActionListener(new CalculatorFrame_btnequal_actionAdapter(this));
this.getContentPane().setBackground(UIManager.getColor(
"MenuItem.background"));
this.setTitle("計算器");
this.getContentPane().add(txtresult);
this.getContentPane().add(btn1);
this.getContentPane().add(btn0);
this.getContentPane().add(btnclear);
this.getContentPane().add(btnplus);
this.getContentPane().add(btnequal);
this.getContentPane().add(btn2);
this.getContentPane().add(btn3);
this.getContentPane().add(btnminus);
this.getContentPane().add(btn4);
this.getContentPane().add(btn7);
this.getContentPane().add(btn5);
this.getContentPane().add(btn6);
this.getContentPane().add(btnjultiply);
this.getContentPane().add(btndivide);
this.getContentPane().add(btn9);
this.getContentPane().add(btn8);
}

public void btnplus_actionPerformed(ActionEvent e) {
action = "plus";
operand1 = txtresult.getText();
txtresult.setText("");
flag = true;
}

public void btnminus_actionPerformed(ActionEvent e) {
action = "minus";
operand1 = txtresult.getText();
txtresult.setText("");
flag = true;
}

public void btnjultiply_actionPerformed(ActionEvent e) {
action = "multiply";
operand1 = txtresult.getText();
txtresult.setText("");
flag = true;
}

public void btndivide_actionPerformed(ActionEvent e) {
action = "divide";
operand1 = txtresult.getText();
txtresult.setText("");
flag = true;
}

public void btnclear_actionPerformed(ActionEvent e) {
txtresult.setText("");
}

public void btn1_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn1.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn1.getActionCommand());
}

}

public void btn2_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn2.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn2.getActionCommand());
}

}

public void btn3_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn3.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn3.getActionCommand());
}

}

public void btn4_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn4.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn4.getActionCommand());
}

}

public void btn5_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn5.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn5.getActionCommand());
}

}

public void btn6_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn6.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn6.getActionCommand());
}

}

public void btn7_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn7.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn7.getActionCommand());
}

}

public void btn8_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn8.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn8.getActionCommand());
}

}

public void btn9_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn9.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn9.getActionCommand());
}

}

public void btn0_actionPerformed(ActionEvent e) {
if (flag) {
txtresult.setText(btn0.getActionCommand());
flag=false;
} else {
txtresult.setText(txtresult.getText() + btn0.getActionCommand());
}

}

public void btnequal_actionPerformed(ActionEvent e) {
double digit1, digit2;
operand2 = txtresult.getText();
if (flag == false) {
if (action.equals("plus")) {
digit1 = Double.parseDouble(operand1);
digit2 = Double.parseDouble(operand2);
result = digit1 + digit2;
txtresult.setText(String.valueOf((int) result));
flag = true;
} else if (action.equals("minus")) {
digit1 = Double.parseDouble(operand1);
digit2 = Double.parseDouble(operand2);
result = digit1 - digit2;
txtresult.setText(String.valueOf((int) result));
flag = true;
} else if (action.equals("multiply")) {
digit1 = Double.parseDouble(operand1);
digit2 = Double.parseDouble(operand2);
result = digit1 * digit2;
txtresult.setText(String.valueOf((int) result));
flag = true;
} else if (action.equals("divide")) {
digit1 = Double.parseDouble(operand1);
digit2 = Double.parseDouble(operand2);
result = digit1 / digit2;
if (digit2==0) {
txtresult.setText("ERROR");
flag=true;
} else {
txtresult.setText(String.valueOf((int) result));
flag = true;
}
}

}

}

class CalculatorFrame_btnequal_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btnequal_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnequal_actionPerformed(e);
}
}

class CalculatorFrame_btn0_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn0_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn0_actionPerformed(e);
}
}

class CalculatorFrame_btn9_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn9_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn9_actionPerformed(e);
}
}

class CalculatorFrame_btn8_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn8_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn8_actionPerformed(e);
}
}

class CalculatorFrame_btn7_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn7_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn7_actionPerformed(e);
}
}

class CalculatorFrame_btn6_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn6_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn6_actionPerformed(e);
}
}

class CalculatorFrame_btn5_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn5_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn5_actionPerformed(e);
}
}

class CalculatorFrame_btn4_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn4_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn4_actionPerformed(e);
}
}

class CalculatorFrame_btn2_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn2_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn2_actionPerformed(e);
}
}

class CalculatorFrame_btn3_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn3_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn3_actionPerformed(e);
}
}

class CalculatorFrame_btnclear_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btnclear_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnclear_actionPerformed(e);
}
}

class CalculatorFrame_btndivide_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btndivide_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btndivide_actionPerformed(e);
}
}

class CalculatorFrame_btnjultiply_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btnjultiply_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnjultiply_actionPerformed(e);
}
}

class CalculatorFrame_btnminus_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btnminus_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnminus_actionPerformed(e);
}
}

class CalculatorFrame_btnplus_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btnplus_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnplus_actionPerformed(e);
}
}

class CalculatorFrame_btn1_actionAdapter implements ActionListener {
private CalculatorFrame adaptee;
CalculatorFrame_btn1_actionAdapter(CalculatorFrame adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn1_actionPerformed(e);
}
}
}

public class Calculator {

public static void main(String[] args) {

CalculatorFrame Objcal=new CalculatorFrame();

Objcal.setSize(410,320);
Objcal.setVisible(true);
}
}

⑶ vc++ 如果兩個字元串的字元和長度都相等,則輸出equal,否則輸出unequal,要求用字元指針

用以下方法可以解決:
#include"stdio.h"
#include"string.h"
void main()
{
char use1[100],use2[100];
char *p,*q;
p=use1,q=use2;
printf("\n請輸入一串字元:");
gets(use1);
printf("\n請輸入另一串字元:");
gets(use2);
if(strcmp(p,q)==0)//比較字元串use1和use2;
printf("\n equal \n");
else
printf("\n unequal \n");
}

其實就是用比較字元串的函數strcmp(str1,str2)就可以了,我是初學,也許不對啊!

⑷ java 中actionPerformed的用法

你的那個 btnEqual 不能夠被解析,也就是說,你定義的位置,有問題。看不到這個符號,Button btnEqual=new Button("=");
往前提一下,就OK

import java.awt.*;
import java.awt.event.*;
public class Test
{
public static void main(String args[])
{
new TFFrame().launchFrame();
}
}
class TFFrame extends Frame
{
/**
*
*/
Label lbPlus=new Label("+");
Button btnEqual=new Button("=");
private static final long serialVersionUID = 1L;
TextField num1,num2,num3;
public void launchFrame()
{
num1=new TextField(10);
num2=new TextField(10);
num3=new TextField(15);

//btnEqual.addActionListener(new MyMonitor(this));
//btnEqual.addActionListener(new MyMonitor (num1,num2,num3));

btnEqual.addActionListener(new MyMonitor());
setLayout(new FlowLayout());
add(num1);
add(lbPlus);
add(num2);
add(btnEqual);
add(num3);
pack();
setVisible(true);
}

class MyMonitor implements ActionListener
{
public void actionPerformed(ActionEvent e)
{

if(e.getSource()==btnEqual)
{int n1=Integer.parseInt(num1.getText());
int n2=Integer.parseInt(num2.getText());

num3.setText(""+(n1+n2));
}}
}
}

⑸ 用VC++編寫內嵌匯編語言,幫忙解釋一下一個程序的意思

mov eax,frist
sub eax,second
jnz nequal
你對匯編指令不熟悉,
lea是取地址。之前messge是字元串,所以要使用取地址
jnz就是判斷sub指令後的結果,jump if not zero的縮寫,如果結果不是0就跳轉
=====================================
你們這是什麼課啊?還有教反匯編的?還是編譯原理??

⑹ C#計算器 (要求:一個textbox接受輸入一個計算按鈕一個顯示結果的textbox)

數據結構課就有講過表達式求值的演算法,你隨便找本數據結構的書來看看就知道了,或者在網路搜索「表達式求值」也有很多答案。
我曾經寫了一個: 稍微改改就能移植到WinForm下面了。核心代碼為一個類:BiaoDaShi,裡面的方法都為靜態的方法。主要有3個大過程:
1、預處理,把表達式裡面的各元素(數字,標識符,算符,括弧)識別出來,並存儲在一個鏈表裡面,如果有不合法的元素標志出錯的位置。
2、把中綴式轉換成後綴式。
3、對後綴式求值。
你把這個類寫在項目裡面,然後在你的button按鈕的事件裡面引用類的方法不就行了嗎?就像我的主函數Main 里那樣的使用。或者你改改,思路就是那樣的。
namespace BiaoDaShi
{
class Program
{
static void Main(string[] args)
{
List<BiaoDaShi.YuanShu> YCL=new List<BiaoDaShi.YuanShu>();
List<BiaoDaShi.YuanShu> HZS=new List<BiaoDaShi.YuanShu>();
string ss = Console.ReadLine();
while (ss.Length != 0)
{
YCL = BiaoDaShi.YuChuLi(ss);
if (YCL[0].LB == BiaoDaShi.LeiBie.CuoWu)
{
Console.WriteLine("錯誤:{0}", YCL[0].Zhi);
}
else
{
HZS = BiaoDaShi.ToHouZhuiShi(YCL);
for (int i = 0; i < HZS.Count; i++)
{
Console.Write(HZS[i].Zhi);
Console.Write(' ');
}
Console.Write("----");
Console.Write("結果:");
Console.Write(BiaoDaShi.JiSuan(HZS));
}
Console.WriteLine();
ss = Console.ReadLine();
}
Console.Read();
}
}
class BiaoDaShi
{
/// <summary>
/// 枚舉表達式裡面各數據的類別(數字,標識符,算符,左括弧,右括弧,錯誤)
/// </summary>
public enum LeiBie {ShuZi,BiaoShiFu,SuanFu,ZuoKuoHao,YouKuoHao,CuoWu };
/// <summary>
/// 表達式裡面元素的結構(類型,值)
/// </summary>
public struct YuanShu
{
public LeiBie LB;
public string Zhi;
public YuanShu(LeiBie lb, string )
{
this.LB = lb;
this.Zhi = ;
}
};
/// <summary>
/// 比較2個算符的優先順序
/// </summary>
/// <param name="ch1"></param>
/// <param name="ch2"></param>
/// <returns></returns>
public static char BiJiao(string ch1, string ch2)
{
int i = YouXianJi(ch1);
int j = YouXianJi(ch2);
if (i<j)
{
return '<';
}
else if (i == j)
{
return '>';
}
else
{
return '>';
}
}
/// <summary>
/// 取得單個字元的優先順序
/// </summary>
/// <param name="ch"></param>
/// <returns></returns>
public static int YouXianJi(string ch)
{
switch (ch)
{
case "+": return 1;
case "-": return 1;
case "*": return 2;
case "/": return 2;
case "div": return 2;
case "mod": return 2;
default: return 0;
}
}
/// <summary>
/// 給字元分類(數字,字母,算符,左括弧,右括弧,錯誤)
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
public static char ZiFuCeSi(char c)
{
int unicode = Convert.ToInt16(c);
if (unicode >= 48 && unicode <= 58)
{
return 'D';//數字
}
else if (unicode >= 65 && unicode <= 90)
{
return 'L';//字母
}
else if (unicode >= 97 && unicode <= 122)
{
return 'L';//字母
}
else if (unicode == '+' || unicode == '-' || unicode == '*' || unicode == '/' || unicode == '%' || unicode == '$')
{
return 'F';//算符
}
else if (unicode == '(')
{
return '(';
}
else if (unicode == ')')
{
return ')';
}
else
{
return 'E';//錯誤
}
}
/// <summary>
/// 預處理
/// </summary>
/// <param name="ZhongZhuiShi"></param>
/// <returns></returns>
public static List<YuanShu> YuChuLi(string ZhongZhuiShi)
{
List<YuanShu> LChuLi=new List<YuanShu>();
if (ZhongZhuiShi.Length == 0)
{
YuanShu ys=new YuanShu(LeiBie.CuoWu,"空串");
LChuLi.Add(ys);
return LChuLi;
}
//預處理中綴表達式字元串
if (ZhongZhuiShi.Contains("mod"))
{//把「mod」替換成「%」
ZhongZhuiShi = ZhongZhuiShi.Replace("mod", "%");
}
if (ZhongZhuiShi.Contains("div"))
{//把「div」替換成「$」
ZhongZhuiShi = ZhongZhuiShi.Replace("div", "$");
}

char Ctemp = ' ';
string Stemp = " ";
int ZLength = ZhongZhuiShi.Length;//表達式的長度
Stack<Char> CStack = new Stack<char>();//用於檢查括弧是否匹配

#region for循環開始

for (int i = 0; i < ZLength; i++)
{
Ctemp = ZhongZhuiShi[i];
Stemp = "";

#region switch-case開始

switch (ZiFuCeSi(Ctemp))
{
case 'D':
{
do
{
Stemp += Ctemp;
if (i == ZLength - 1)
{
break;
}
i++;
Ctemp = ZhongZhuiShi[i];
} while (ZiFuCeSi(Ctemp) == 'D');
YuanShu ys = new YuanShu(LeiBie.ShuZi, Stemp);
LChuLi.Add(ys);
if (ZiFuCeSi(Ctemp) != 'D')
{
if (ZiFuCeSi(Ctemp) == 'L')
{
YuanShu yse = new YuanShu(LeiBie.CuoWu, "錯誤的數字組合在位置"+i.ToString());
List<YuanShu> Error = new List<YuanShu>();
Error.Add(yse);
return Error;
}
i--;
}
break;
}
case 'L':
{
do
{
Stemp += Ctemp;
if (i == ZLength - 1)
{
break;
}
i++;
Ctemp = ZhongZhuiShi[i];
} while (ZiFuCeSi(Ctemp) == 'L' || ZiFuCeSi(Ctemp) == 'D');
YuanShu ys = new YuanShu(LeiBie.BiaoShiFu, Stemp);
LChuLi.Add(ys);
if (ZiFuCeSi(Ctemp) != 'L')
{
i--;
}
break;
}
case 'F':
{
if (i == 0 || i == ZLength - 1)
{
YuanShu yse = new YuanShu(LeiBie.CuoWu, "錯誤的算符位置在" + i.ToString());
List<YuanShu> Error = new List<YuanShu>();
Error.Add(yse);
return Error;
}
if (ZiFuCeSi(ZhongZhuiShi[i + 1]) == 'F' || ZiFuCeSi(ZhongZhuiShi[i + 1]) == ')')
{
YuanShu yse = new YuanShu(LeiBie.CuoWu, "錯誤的算符位置在"+i.ToString());
List<YuanShu> Error = new List<YuanShu>();
Error.Add(yse);
return Error;
}
YuanShu ys = new YuanShu(LeiBie.SuanFu, Ctemp.ToString());
if (Ctemp == '%' )
{
ys.Zhi = "mod";
}
if ( Ctemp == '$')
{
ys.Zhi = "div";
}
LChuLi.Add(ys);
break;
}
case '(':
{
CStack.Push('(');
YuanShu ys = new YuanShu(LeiBie.ZuoKuoHao, "(");
LChuLi.Add(ys);
break;
}
case ')':
{
if (CStack.Count == 0)
{
YuanShu yse = new YuanShu(LeiBie.CuoWu, "括弧不匹配");
List<YuanShu> Error = new List<YuanShu>();
Error.Add(yse);
return Error;
}
else
{
CStack.Pop();
}
YuanShu ys = new YuanShu(LeiBie.YouKuoHao, ")");
LChuLi.Add(ys);
break;
}
default:
{
YuanShu ys = new YuanShu(LeiBie.CuoWu, "表達式里有不合法的字元在位置"+i.ToString());
List<YuanShu> Error = new List<YuanShu>();
Error.Add(ys);
return Error;
}
}
#endregion
}
#endregion

if (CStack.Count != 0)
{
YuanShu ys = new YuanShu(LeiBie.CuoWu, "括弧不匹配");
List<YuanShu> Error = new List<YuanShu>();
Error.Add(ys);
return Error;
}

return LChuLi;
}
/// <summary>
/// 中綴式轉後綴式
/// </summary>
/// <param name="LChuLi"></param>
/// <returns></returns>
/// 將中綴表達式轉換為後綴表達式的演算法思想:
///·當讀到數字直接送至輸出隊列中
///·當讀到運算符t時,
///a.將棧中所有優先順序高於或等於t的運算符彈出,送到輸出隊列中;
///b.t進棧
///·讀到左括弧時總是將它壓入棧中
///·讀到右括弧時,將靠近棧頂的第一個左括弧上面的運算符全部依次彈出,送至輸出隊列後,再丟棄左括弧。
public static List<YuanShu> ToHouZhuiShi(List<YuanShu> LChuLi)
{
List<YuanShu> HouZhuiShi = new List<YuanShu>();
if (LChuLi[0].LB == LeiBie.CuoWu)
{
YuanShu ys = new YuanShu(LeiBie.CuoWu, "錯誤的表達式");
HouZhuiShi.Add(ys);
return HouZhuiShi;
}
Stack<YuanShu> NewStack = new Stack<YuanShu>();
string SSuanFuNow = "";
string SSuanFuSTop = "";
#region for循環開始
for (int i = 0; i < LChuLi.Count; i++)
{
#region switch-case開始
switch (LChuLi[i].LB)
{
case LeiBie.ShuZi:
//{
// HouZhuiShi.Add(LChuLi[i]);
// break;
//}
case LeiBie.BiaoShiFu:
{
HouZhuiShi.Add(LChuLi[i]);
break;
}
case LeiBie.SuanFu:
{
if (NewStack.Count == 0)
{
NewStack.Push(LChuLi[i]);
break;
}
while (NewStack.Count != 0)
{
SSuanFuNow = LChuLi[i].Zhi;
SSuanFuSTop = NewStack.Peek().Zhi;
if (BiJiao(SSuanFuSTop, SSuanFuNow) == '>')
{
HouZhuiShi.Add(NewStack.Pop());
}
else
{
break;
}
}
NewStack.Push(LChuLi[i]);
break;
}
case LeiBie.ZuoKuoHao:
{
NewStack.Push(LChuLi[i]);
break;
}
case LeiBie.YouKuoHao:
{
while (NewStack.Count != 0 && NewStack.Peek().LB != LeiBie.ZuoKuoHao)
{
HouZhuiShi.Add(NewStack.Pop());
}
if (NewStack.Count != 0)
{
NewStack.Pop();
}
break;
}
}
#endregion
}
#endregion
while (NewStack.Count != 0)
{
HouZhuiShi.Add(NewStack.Pop());
}
return HouZhuiShi;
}
/// <summary>
/// 計算後綴式的值
/// </summary>
/// <param name="HouZhuiShi"></param>
/// <returns></returns>
public static int JiSuan(List<YuanShu> HouZhuiShi)
{
Stack<Int32> JS = new Stack<Int32>();
for (int i = 0; i < HouZhuiShi.Count; i++)
{
switch (HouZhuiShi[i].LB)
{
case LeiBie.ShuZi:
{
JS.Push(Convert.ToInt32(HouZhuiShi[i].Zhi));
break;
}
case LeiBie.BiaoShiFu:
{
JS.Push(0);
break;
}
case LeiBie.SuanFu:
{
int JieGuo;
if (SiZeYunSuan(JS.Pop(), JS.Pop(), HouZhuiShi[i].Zhi, out JieGuo))
{
JS.Push(JieGuo);
break;
}
else
{
Console.WriteLine("不能除0");
return 0;
}
}
}
}
return JS.Pop();
}
/// <summary>
/// 四則運算操作數a,b,算符sf,結果c
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <param name="sf"></param>
/// <param name="c"></param>
/// <returns></returns>
public static bool SiZeYunSuan(int a, int b, string sf,out int c)
{
switch (sf)
{
case "+": c = b + a; return true;
case "-": c = b - a; return true;
case "*": c = b * a; return true;
case "div":
case "/":
{
if (a != 0)
{
c = b / a;
return true;
}
else
{
c = 0;
return false;
}
}
case "mod":
{
if (a != 0)
{
c = b % a;
return true;
}
else
{
c = 0;
return false;
}
}
default: c = 0; return false;
}
}
}
}

⑺ 老師給的例題,用Microsoft Visual Studio編的,這到底是C語言還是匯編啊

是C語言。不過程序的主要功能通過內嵌匯編完成。
「內嵌匯編」就是指,用_asm{}將匯編代碼嵌入到C語言程序當中。
程序功能比較簡單:先列印信息提示輸入一個數,然後讀入一個數,然後再列印信息提示輸入另一個數,然後再讀入一個數,然後比較兩數是否相等並輸出比較結果,然後提示程序結束,輸入任意數按回車退出。
其中列印信息是調用printf,讀入數據調用的scanf。
Visual Studio就是微軟的集成開發環境,主要用來開發運行於windows的應用程序,具有(但不限於)編寫、編譯、調試C/C++程序的功能。

⑻ equals音標

iequal
[5i:kwEl]
adj.
相等的, 均等的, 勝任的, 平靜的, 合適的, 不相上下的
n.
相等的事物(或數量), 對手, 匹敵, 同輩
vt.
等於, 比得上

equal
[5i:kw(E)l]
adj.
(常與to, with連用)相同的
cut the cake into six equal pieces
把蛋糕等分成六塊
One li is equal to half a kilometre.
一華里等於半公里。
It is equal to me whether he comes or not.
他來不來對我都一樣。
勝任的;經得起的
John is quite equal to the job of running the office.
約翰很能勝任主理這個辦事處的工作。
He is equal to this task.; He is equal to doing this task.
他能勝任這項任務。

on equal terms
平等相處

equal
n.
同等的人,相等的人
equal
Lex x be the equal of y.
設x等於y。
Is he your equal in play chess?
他的棋藝跟你一樣好嗎?
vt.
-ll-; (AmE.) -l-
與…相等,等於
『x = y』 means that x equals y. 「x = y」
就是 x 與 y 相等。
Three and five equals eight.
三加五等於八。
Eight times eight equals sixty-four.
八乘八等於六十四。
比得上
None of us can equal her.
沒人比得上她。

equal
[5i:kwEl]
adj.
相等的, 平等的, 均衡的(to, with); 同等的, 公正的, 公平的; 一樣的
平穩的, 平靜的
均勻的; 相當的
適合的; 勝任的, 經得起的; 足夠的
equal pay for equal work
同工同酬
equal in ability
能力相等
divide sth. into twoequal parts
將某物二等分
equal time
[美](在無線電或電視廣播中分配給不同政黨候選人的)相等時間; (答辯控告或發表不同意見的)均等機會
All countries, big and small, should be equal.
國家不論大小, 一律平等。
He was equal to the occasion.
他能應付這個局勢 。
She did not feel equal to receiving visitors.
她的身體不適, 不能接見客人。

equal
[5i:kwEl]
n.
同級別的人; 同輩
相等的事物[數量]
匹敵者; 可與比擬的東西
mix with one's equals and betters
與同你相等或比你更好的人交往
have no equal in music
在音樂方面沒有人比得上
equal
[5i:kwEl]
vt.
(equal(l)ed; equal(l)ing)
比得上; 抵得過
等於
[古]使相等, 使平等[均]; 同等看待; 照樣報答
He equals me in strength but not in intelligence.
他和我力氣相等, 但智力不同。

equal-sign [mark]
n.
等號(=)

be equal to
等於; 與....相等
有...的能力[勇氣, 力量等]
勝任, 能幹
忍耐得住
be the equal to one's word
說到做到
be without equal
無比, 無敵
feel equal to
[口]能勝任, 有能力去做
other things being equal
在其它條件都相同的情況下

見 same

equal
來自拉丁語aequalis相等的<aequus平的

equal
.

⑼ Delphi 計算器,連續加減乘除問題

在加減乘除的處理過程的尾部,加上調用等號處理過程的句子。即如下:
procere TForm1.btnAddClick(Sender: TObject);
begin
Key := 1;
Temp1 := strtofloat(Edit1.text);
Edit1.Clear;
btnEqualClick(Sender);
end;

procere TForm1.btnMinusClick(Sender: TObject);
begin
Key := 2;
Temp1 := strtofloat(Edit1.Text);
Edit1.Clear;
btnEqualClick(Sender);
end;

procere TForm1.btnMultClick(Sender: TObject);
begin
Key := 3;
Temp1 := strtofloat(Edit1.Text);
Edit1.Clear;
btnEqualClick(Sender);
end;

procere TForm1.btnDiveClick(Sender: TObject);
begin
Key := 4;
Temp1 := strtofloat(Edit1.Text);
Edit1.Clear;
btnEqualClick(Sender);
end;

其實,你這個過程可以大大簡化,方法是:
1、設置加減乘除四個按鈕的屬性tag分別為1~4
2、統一設置加減乘除的處理過程為Operate
procere TForm1.Operate(Sender: TObject);
begin
Key := TButton( Sender ).Tag;
Temp1 := strtofloat(Edit1.Text);
Edit1.Clear;
btnEqualClick(Sender);
end;
3、0~9和.的按鈕也同樣可以採用如上分別預設屬性而統一處理過程的套路
0~9的tag分別為$30~$39,.的tag為$24,統一過程的內容是Edit1.Text := Edit1.Text + Chr( TButton( Sender ).Tag ) );

⑽ 求只需要加減乘除功能的簡單的java計算器小程序!

package jisuanqi;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.BorderFactory;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTextField;
import javax.swing.*;

/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Jisuan extends JFrame {
JPanel contentPane;
JButton btnmultiply = new JButton();
JButton btn3 = new JButton();
JButton btndivide = new JButton();
JButton btn2 = new JButton();
JButton btn5 = new JButton();
JButton btn0 = new JButton();
JButton btnclear = new JButton();
JButton btnequal = new JButton();
JButton btn1 = new JButton();
JButton btn6 = new JButton();
JButton bntplus = new JButton();
JButton btnminus = new JButton();
JButton btn4 = new JButton();
JButton btn9 = new JButton();
JButton btn8 = new JButton();
JButton btn7 = new JButton();
JPanel jPanel1 = new JPanel();
JTextField txt = new JTextField();
boolean flag=false;
String operand1;
String operand2;
double result;
String action;

public Jisuan() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}

/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(300, 400));
setTitle("Frame Title");
btnmultiply.setBounds(new Rectangle(227, 322, 42, 35));
btnmultiply.setText("+");
btnmultiply.addActionListener(new Jisuan_jButton1_actionAdapter(this));
contentPane.setBorder(BorderFactory.createEtchedBorder());
contentPane.setToolTipText("");
btn3.setBounds(new Rectangle(160, 263, 42, 35));
btn3.setText("3");
btn3.addActionListener(new Jisuan_btn3_actionAdapter(this));
btndivide.setBounds(new Rectangle(227, 263, 42, 35));
btndivide.setText("-");
btndivide.addActionListener(new Jisuan_jButton3_actionAdapter(this));
btn2.setBounds(new Rectangle(93, 263, 42, 35));
btn2.setText("2");
btn2.addActionListener(new Jisuan_btn2_actionAdapter(this));
btn5.setBounds(new Rectangle(93, 201, 42, 35));
btn5.setText("5");
btn5.addActionListener(new Jisuan_btn5_actionAdapter(this));
btn0.setBounds(new Rectangle(25, 322, 42, 35));
btn0.setText("0");
btn0.addActionListener(new Jisuan_btn0_actionAdapter(this));
btnclear.setBounds(new Rectangle(93, 322, 42, 35));
btnclear.setText("c");
btnclear.addActionListener(new Jisuan_jButton7_actionAdapter(this));
btnequal.setBounds(new Rectangle(160, 322, 42, 35));
btnequal.setText("=");
btnequal.addActionListener(new Jisuan_btnequal_actionAdapter(this));
btn1.setBounds(new Rectangle(25, 263, 42, 35));
btn1.setText("1");
btn1.addActionListener(new Jisuan_btn1_actionAdapter(this));
btn6.setBounds(new Rectangle(160, 201, 42, 35));
btn6.setText("6");
btn6.addActionListener(new Jisuan_btn6_actionAdapter(this));
bntplus.setBounds(new Rectangle(227, 201, 42, 35));
bntplus.setText("*");
bntplus.addActionListener(new Jisuan_btnminus_actionAdapter(this));
btnminus.setBounds(new Rectangle(227, 137, 42, 35));
btnminus.setText("/");
btnminus.addActionListener(new Jisuan_bntplus_actionAdapter(this));
btn4.setBounds(new Rectangle(25, 201, 42, 35));
btn4.setText("4");
btn4.addActionListener(new Jisuan_btn4_actionAdapter(this));
btn9.setBounds(new Rectangle(160, 137, 42, 35));
btn9.setText("9");
btn9.addActionListener(new Jisuan_btn9_actionAdapter(this));
btn8.setBounds(new Rectangle(93, 137, 42, 35));
btn8.setText("8");
btn8.addActionListener(new Jisuan_btn8_actionAdapter(this));
btn7.setBounds(new Rectangle(25, 137, 42, 35));
btn7.setText("7");
btn7.addActionListener(new Jisuan_btn7_actionAdapter(this));
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setBounds(new Rectangle(13, 128, 270, 244));
txt.setHorizontalAlignment(SwingConstants.RIGHT);
txt.setBounds(new Rectangle(13, 61, 270, 46));
contentPane.add(btndivide);
contentPane.add(btn3);
contentPane.add(btn2);
contentPane.add(btnclear);
contentPane.add(btnmultiply, null);
contentPane.add(btnequal);
contentPane.add(btn1);
contentPane.add(btn0);
contentPane.add(btn5);
contentPane.add(btn6);
contentPane.add(bntplus);
contentPane.add(btn4);
contentPane.add(btn7);
contentPane.add(btn8);
contentPane.add(btn9);
contentPane.add(btnminus);
contentPane.add(jPanel1);
contentPane.add(txt);
}

public void jButton1_actionPerformed(ActionEvent e) {
action="plus";
operand1=txt.getText();
txt.setText("");
flag=true;
}

public void jButton3_actionPerformed(ActionEvent e) {
action="minus";
operand1=txt.getText();
txt.setText("");
flag=true;
}

public void btn1_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn1.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn1.getActionCommand());
}
}
public void btn6_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn6.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn6.getActionCommand());
}
}
public void btn2_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn2.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn2.getActionCommand());
}
}
public void btn3_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn3.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn3.getActionCommand());
}
}
public void btn4_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn4.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn4.getActionCommand());
}
}
public void btn5_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn5.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn5.getActionCommand());
}
}
public void btn7_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn7.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn7.getActionCommand());
}
}
public void btn8_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn8.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn8.getActionCommand());
}
}
public void btn9_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn9.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn9.getActionCommand());
}
}
public void btn0_actionPerformed(ActionEvent e) {
if(flag){
txt.setText(btn0.getActionCommand());
flag=false;
}
else{
txt.setText(txt.getText()+btn0.getActionCommand());
}
}

public void jButton7_actionPerformed(ActionEvent e) {
txt.setText("");
}

public void bntplus_actionPerformed(ActionEvent e) {
/*
operand1=Integer.parseInt(txt.getText());
action="plus";
flag=true;
*/
action="divide";
operand1=txt.getText();
txt.setText("");
flag=true;
}

public void btnminus_actionPerformed(ActionEvent e) {
action="multiply";
operand1=txt.getText();
txt.setText("");
flag=true;
}

public void btnequal_actionPerformed(ActionEvent e) {
double digit1;
double digit2;
operand2=txt.getText();
if(flag==false){
if(action.equals("divide")){
digit1=Integer.parseInt(operand1);
digit2=Integer.parseInt(operand2);
result=digit1 / digit2;
txt.setText(new Double(result).toString());
flag=true;
}else if(action.equals("plus")){
digit1=Integer.parseInt(operand1);
digit2=Integer.parseInt(operand2);
result=digit1 + digit2;
txt.setText(""+(int)result);
flag=true;
}else if(action.equals("multiply")){
digit1=Integer.parseInt(operand1);
digit2=Integer.parseInt(operand2);
result=digit1 * digit2;
txt.setText(""+(int)result);
flag=true;
}else if(action.equals("minus")){
digit1=Integer.parseInt(operand1);
digit2=Integer.parseInt(operand2);
result=digit1-digit2;
txt.setText(""+(int)result);
flag=true;
}
}
}

}

class Jisuan_btnminus_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btnminus_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnminus_actionPerformed(e);
}
}

class Jisuan_bntplus_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_bntplus_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.bntplus_actionPerformed(e);
}
}

class Jisuan_jButton7_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_jButton7_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton7_actionPerformed(e);
}
}

class Jisuan_btn0_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn0_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn0_actionPerformed(e);
}
}

class Jisuan_btn9_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn9_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn9_actionPerformed(e);
}
}

class Jisuan_btn8_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn8_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn8_actionPerformed(e);
}
}

class Jisuan_btn7_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn7_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn7_actionPerformed(e);
}
}

class Jisuan_btn6_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn6_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn6_actionPerformed(e);
}
}

class Jisuan_btn5_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn5_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn5_actionPerformed(e);
}
}

class Jisuan_btn4_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn4_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn4_actionPerformed(e);
}
}

class Jisuan_btn3_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn3_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn3_actionPerformed(e);
}
}

class Jisuan_btn2_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn2_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn2_actionPerformed(e);
}
}

class Jisuan_btn1_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btn1_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btn1_actionPerformed(e);
}
}

class Jisuan_jButton3_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_jButton3_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}

class Jisuan_jButton1_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_jButton1_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}

class Jisuan_btnequal_actionAdapter implements ActionListener {
private Jisuan adaptee;
Jisuan_btnequal_actionAdapter(Jisuan adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.btnequal_actionPerformed(e);
}
}
這個是實現的方法,按鈕的名字不一定一樣,最主要是這個要一樣 action="minus";

main方法 用JB他自己就生成啦