Last active
March 30, 2017 10:34
-
-
Save tuankiet65/10c400c87944584e9a4dcb6af2643476 to your computer and use it in GitHub Desktop.
Simple calculator in C# (fixing for a friend)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 testlaiwinform | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void textBox1_TextChanged(object sender, EventArgs e) | |
{ | |
} | |
private void textBox3_TextChanged(object sender, EventArgs e) | |
{ | |
} | |
private void textBox2_TextChanged(object sender, EventArgs e) | |
{ | |
} | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
int bien1; | |
int bien2; | |
int kq; | |
bien1 = int.Parse(textBox1.Text); | |
bien2 = int.Parse(textBox3.Text); | |
if (textBox2.Text == "+") { | |
kq = bien1 + bien2; | |
} else if (textBox2.Text == "-"){ | |
kq = bien1 - bien2; | |
} else if (textBox2.Text == "x"){ | |
kq = bien1 * bien2; | |
} else if (textBox2.Text == ":"){ | |
kq = bien1 / bien2; | |
} | |
string kq1; | |
kq1 = kq.ToString(); | |
label2.Text = kq1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment