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 WindowsFormsApplication1 { public partial class Form1 : Form { string s1, s2,oper; public Form1() { InitializeComponent(); } private void btn0_Click(object sender, EventArgs e) { textBox1.Text += btn0.Text; } private void btn1_Click(object sender, EventArgs e) { textBox1.Text += btn1.Text; } private void btn2_Click(object sender, EventArgs e) { textBox1.Text += btn2.Text; } private void btn3_Click(object sender, EventArgs e) { textBox1.Text += btn3.Text; } private void btn4_Click(object sender, EventArgs e) { textBox1.Text += btn4.Text; } private void btn5_Click(object sender, EventArgs e) { textBox1.Text += btn5.Text; } private void btn6_Click(object sender, EventArgs e) { textBox1.Text += btn6.Text; } private void BTn7_Click(object sender, EventArgs e) { textBox1.Text += BTn7.Text; } private void btn8_Click(object sender, EventArgs e) { textBox1.Text += btn8.Text; } private void btn9_Click(object sender, EventArgs e) { textBox1.Text += btn9.Text; } private void btnpoint_Click(object sender, EventArgs e) { string s = textBox1.Text; int j = 0; for (int i = 0; i < s.Length; i++) { if (s[i] == '.') { j = 0; break; } else { j = 1; } } if (j == 1) { textBox1.Text += btnpoint.Text; } } private void btnPlus_Click(object sender, EventArgs e) { string s1 = textBox1.Text; textBox1.Text = ""; oper = "+"; } private void btneql_Click(object sender, EventArgs e) { int e1; double equal; if (oper == "+") { string s = textBox1.Text; int j = 0; for (int i = 0; i < s.Length; i++) { if (s[i] == '.') { j = 0; break; } else { j = 1; } } if (j == 1) { string s2 = textBox1.Text; e1 = int.Parse(s1) + int.Parse(s2); textbox1.text=e1.ToString(); } else { string s2 = textBox1.Text; equal = double.Parse(s1) + double.Parse(s2); textbox1.text=equal.ToString(); } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)