Private void Page_Load (object sender, System. EventArgs e)
{
// Place user code here to initialize the page
If (! This. IsPostBack)
{
// Display and store numbers
This. show. Text = "0 ";
// Stores symbols, such as +
This. tp. Text = "";
}
}
Private void yi_Click (object sender, System. EventArgs e)
{
Int tmp = Convert. ToInt32 (this. show. Text );
// If no symbol exists
If (this. tp. Text = "")
{
If (tmp = 0)
{
This. show. Text = "1 ";
}
Else
{
This. show. Text + = "1 ";
}
}
// If the symbol exists
Else
{
If (this. show. Text = "0 ")
{
This. show. Text = "1 ";
}
Else
{
This. show. Text + = "1 ";
}
}
}
Private void er_Click (object sender, System. EventArgs e)
{
Int tmp = Convert. ToInt32 (this. show. Text );
// If no symbol exists
If (this. tp. Text = "")
{
If (tmp = 0)
{
This. show. Text = "2 ";
}
Else
{
This. show. Text + = "2 ";
}
}
// If the symbol exists
Else
{
If (this. show. Text = "0 ")
{
This. show. Text = "2 ";
}
Else
{
This. show. Text + = "2 ";
}
}
}
Private void jia_Click (object sender, System. EventArgs e)
{
If (this. tp. Text = "")
{
This. first. Text = this. show. Text;
This. tp. Text = "+ ";
This. show. Text = "0 ";
}
Else
{
This. show. Text = Convert. ToString (Convert. ToInt32 (this. first. Text) + Convert. ToInt32 (this. show. Text ));
This. tp. Text = "+ ";
This. first. Text = this. show. Text;
This. show. Text = "0 ";
}
}
Private void deng_Click (object sender, System. EventArgs e)
{
If (this. tp. Text = "")
{
;
}
Else
{
This. show. Text = Convert. ToString (Convert. ToInt32 (this. first. Text) + Convert. ToInt32 (this. show. Text ));
This. tp. Text = "";
This. first. Text = this. show. Text;
}
}
}
}