using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
int x,y,z;
Boolean a = false;
Boolean b = false;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = "";
button1.Text = "0";
button2.Text = "00";
button3.Text = "=";
button4.Text = "1";
button5.Text = "2";
button6.Text = "3";
button7.Text = "4";
button8.Text = "5";
button9.Text = "6";
button10.Text = "7";
button11.Text = "8";
button12.Text = "9";
button13.Text = "+";
button14.Text = "-";
button15.Text = "*";
button16.Text = "/";
}
private void button1_Click(object sender, EventArgs e)
{
if (a == false)
{
}
else
{
textBox1.Text += 0;
}
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text += 1;
a = true;
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text += 2;
a = true;
}
private void button6_Click(object sender, EventArgs e)
{
textBox1.Text += 3;
a = true;
}
private void button7_Click(object sender, EventArgs e)
{
textBox1.Text += 4;
a = true;
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text += 5;
a = true;
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text += 6;
a = true;
}
private void button10_Click(object sender, EventArgs e)
{
textBox1.Text += 7;
a = true;
}
private void button11_Click(object sender, EventArgs e)
{
textBox1.Text += 8;
a = true;
}
private void button12_Click(object sender, EventArgs e)
{
textBox1.Text += 9;
a = true;
}
private void button16_Click(object sender, EventArgs e)
{
if (b == true)
{
}
else
{
x = int.Parse(textBox1.Text);
textBox1.Text = "";
a = false;
b = true;
}
}
private void button3_Click(object sender, EventArgs e)
{
if (a == true & b == true)
{
y = int.Parse(textBox1.Text);
z = x / y;
textBox1.Text=""+z;
}
}
}
}
沒有留言:
張貼留言