C# ile yapilan Hesap makinasi programi kodlari ve exe dosyasi. Basit ama kullanışlı program.
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 hesap
{
public partial class Form1 : Form
{
double value = 0;
string operation = "";
bool operation_pressed = false;
public Form1()
{
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
if ((sonuc.Text == "0") || (operation_pressed))
sonuc.Clear();
operation_pressed = false;
Button b = (Button)sender;
sonuc.Text = sonuc.Text + b.Text;
}
private void button14_Click(object sender, EventArgs e)
{
sonuc.Clear();
sonuc.Text = "0";
value = 0;
}
private void operator_click(object sender, EventArgs e)
{
Button b = (Button)sender;
operation = b.Text;
value = double.Parse(sonuc.Text);
operation_pressed = true;
}
private void button18_Click(object sender, EventArgs e)
{
switch (operation)
{
case "+":
sonuc.Text = (value + double.Parse(sonuc.Text)).ToString();
break;
case "-":
sonuc.Text = (value - double.Parse(sonuc.Text)).ToString();
break;
case "*":
sonuc.Text = (value * double.Parse(sonuc.Text)).ToString();
break;
case "/":
sonuc.Text = (value / double.Parse(sonuc.Text)).ToString();
break;
default:
break;
}
}
private void button15_Click(object sender, EventArgs e)
{
sonuc.Clear();
sonuc.Text = "0";
value = 0;
}
}
}
Hesap makinası programın exe dosyasını buradan indirebilir siniz.
Hiç yorum yok:
Yorum Gönder
Her yorum bilgidir. Araştırmaya devam...