2015年11月5日 星期四
計算機
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
String aa;
String m;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button1_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button9_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button8_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button7_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button6_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button5_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button4_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button3_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button10_Click(object sender, EventArgs e)
{
Button b = sender as Button;
textBox1.Text += b.Text;
}
private void button11_Click(object sender, EventArgs e)
{
Button mb = sender as Button;
m = mb.Text;
aa = textBox1.Text;
textBox1.Text = "";
}
private void button13_Click(object sender, EventArgs e)
{
Button mb = sender as Button;
m = mb.Text;
aa = textBox1.Text;
textBox1.Text = "";
}
private void button12_Click(object sender, EventArgs e)
{
Button mb = sender as Button;
m = mb.Text;
aa = textBox1.Text;
textBox1.Text = "";
}
private void button14_Click(object sender, EventArgs e)
{
Button mb = sender as Button;
m = mb.Text;
aa = textBox1.Text;
textBox1.Text = "";
}
private void button15_Click(object sender, EventArgs e)
{
{
Double a = Double.Parse(aa);
Double b = Int32.Parse(textBox1.Text);
Double c = 0;
switch (m)
{
case "+":
c = a + b;
break;
case "-":
c = a - b;
break;
case "*":
c = a * b;
break;
case "/":
c = a / b;
break;
}
textBox1.Text = c.ToString();
}
}
private void button16_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
private void button17_Click(object sender, EventArgs e)
{
}
}
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言