سورس کد پروژه ماشین حساب مهندسی به زبان سی شارپ
در این ساعت سورس کد یک پروژه حرفه ای و کاربردی را برای عزیزان علاقه مند به برنامه نویسی آماده کرده ایم.این پروژه ماشین حساب مهندسی نام دارد که به زبان سی شارپ برنامه نویسی شده است.به وسیله این پروژه می توانید بسیاری از محاسبات ریاضی را انجام دهید.بعلاوه می توانید سورس کد پروژه Timer به زبان سی شارپ را نیز از سورس ایران دریافت کنید.
سورس کد پروژه ماشین حساب مهندسی به زبان سی شارپ
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 چرتکه { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private String sn, fn, op; private double drg = 0, abc = 0, def = 1; private bool key = false; private int i = 1; private void Form1_Load(object sender, EventArgs e) { } private void button58_Click(object sender, EventArgs e) // 0 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button58.Text; } private void button25_Click(object sender, EventArgs e) // 1 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button25.Text; } private void button23_Click(object sender, EventArgs e) // 2 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button23.Text; } private void button22_Click(object sender, EventArgs e) // 3 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button22.Text; } private void button16_Click(object sender, EventArgs e) // 4 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button16.Text; } private void button15_Click(object sender, EventArgs e) // 5 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button15.Text; } private void button14_Click(object sender, EventArgs e) // 6 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button14.Text; } private void button1_Click(object sender, EventArgs e) // 7 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button1.Text; } private void button2_Click(object sender, EventArgs e) // 8 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button2.Text; } private void button3_Click(object sender, EventArgs e) // 9 { if (key) { textBox1.Clear(); key = false; } textBox1.Text += button3.Text; } private void button59_Click(object sender, EventArgs e) // ± { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { textBox1.Text = (double.Parse(textBox1.Text) * -1).ToString(); } } private void button57_Click(object sender, EventArgs e) // . { if (textBox1.Text == "") textBox1.Text = "0."; else textBox1.Text += button57.Text; } private void button56_Click(object sender, EventArgs e) // + { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("+"); abc += double.Parse(textBox1.Text); textBox1.Clear(); fn = (abc).ToString(); op = "+"; } } private void button21_Click(object sender, EventArgs e) // - { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("-"); abc -= double.Parse(textBox1.Text); if (i == 1) { abc *= -1; i++; } textBox1.Clear(); fn = (abc).ToString(); op = "-"; } } private void button13_Click(object sender, EventArgs e) // × { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("×"); def *= double.Parse(textBox1.Text); textBox1.Clear(); fn = (def).ToString(); op = "*"; } } private void button4_Click(object sender, EventArgs e) // ÷ { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("÷"); fn = textBox1.Text; op = "/"; textBox1.Clear(); } } private void button5_Click(object sender, EventArgs e) // ²√ { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("Square Root ="); if (double.Parse(textBox1.Text) <= 0) { Form ss2 = new Form3(); ss2.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { textBox1.Text = (Math.Sqrt(double.Parse(textBox1.Text))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } } private void button12_Click(object sender, EventArgs e) // ³√ { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("Cube Root ="); double a, x, y, b; b = y = x = 0; a = double.Parse(textBox1.Text); if (a < 0) { a = Math.Abs(a); x = Math.Log(a); y = x / 3; b = Math.Exp(y); b *= -1; } else { x = Math.Log(a); y = x / 3; b = Math.Exp(y); } textBox1.Text = (b).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } private void button20_Click(object sender, EventArgs e) // √ { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { fn = textBox1.Text; listBox1.Items.Add("√"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("Root "); op = "3"; textBox1.Clear(); } } private void button55_Click(object sender, EventArgs e) // % { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("%"); fn = textBox1.Text; op = "%"; textBox1.Clear(); } } private void button6_Click(object sender, EventArgs e) // x² { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("x² ="); textBox1.Text = ((double.Parse(textBox1.Text)) * (double.Parse(textBox1.Text))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } private void button11_Click(object sender, EventArgs e) // x³ { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("x³ ="); textBox1.Text = ((double.Parse(textBox1.Text)) * (double.Parse(textBox1.Text)) * (double.Parse(textBox1.Text))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } private void button19_Click(object sender, EventArgs e) // Pow { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("Pow"); fn = textBox1.Text; op = "^"; textBox1.Clear(); } } private void button29_Click(object sender, EventArgs e) // Fact { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { double number; long fact = 1, n; key = true; listBox1.Items.Add("Factorial"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); number = double.Parse(textBox1.Text); n = (long)(number); for (long j = n; j > 0; j--) fact = fact * j; textBox1.Text = fact.ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } private void button7_Click(object sender, EventArgs e) // log { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; double a = double.Parse(textBox1.Text); listBox1.Items.Add("Log10"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); if (a <= 0) { Form ss2 = new Form4(); ss2.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { textBox1.Text = (Math.Log10(a)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } } private void button10_Click(object sender, EventArgs e) // Ln { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { key = true; double a = double.Parse(textBox1.Text); listBox1.Items.Add("Ln"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); if (a <= 0) { Form ss2 = new Form4(); ss2.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { textBox1.Text = (Math.Log(a)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } } private void button18_Click(object sender, EventArgs e) // Log { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add("Log"); listBox1.Items.Add(textBox1.Text); fn = textBox1.Text; if (double.Parse(textBox1.Text) <= 0) { Form ss2 = new Form4(); ss2.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else op = "log"; textBox1.Clear(); } } private void button28_Click(object sender, EventArgs e) // Exp { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add("Exp"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); textBox1.Text = (Math.Exp(double.Parse(textBox1.Text))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } private void button17_Click(object sender, EventArgs e) // 1/x { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { float temp = 1; listBox1.Items.Add("1/"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); textBox1.Text = (temp / float.Parse(textBox1.Text)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; } } private void button27_Click(object sender, EventArgs e) // Mod { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("Mod"); fn = textBox1.Text; op = "mod"; textBox1.Clear(); } } private void button8_Click(object sender, EventArgs e) // π { double temp = Math.PI; textBox1.Text = temp.ToString(); key = true; } private void button9_Click(object sender, EventArgs e) // e { textBox1.Text = Math.E.ToString(); key = true; } private void button30_Click(object sender, EventArgs e) // = { sn = textBox1.Text; listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); switch (op) { case "+": textBox1.Text = (double.Parse(fn) + double.Parse(sn)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); abc = 0; key = true; break; case "-": textBox1.Text = (double.Parse(fn) - double.Parse(sn)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); abc = 0; i = 1; key = true; break; case "*": textBox1.Text = (double.Parse(fn) * double.Parse(sn)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); def = 1; key = true; break; case "/": textBox1.Text = (double.Parse(fn) / double.Parse(sn)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; case "^": textBox1.Text = (Math.Pow(double.Parse(fn), double.Parse(sn))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; case "%": textBox1.Text = (double.Parse(fn) * (double.Parse(sn) / 100)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; case "mod": textBox1.Text = (double.Parse(fn) % double.Parse(sn)).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; case "log": textBox1.Text = (Math.Log(double.Parse(fn), double.Parse(sn))).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; case "3": double a, x, y, b; int n; b = y = x = 0; a = double.Parse(fn); n = int.Parse(sn); if (n <= 0) { Form ss1 = new Form3(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); key = true; break; } else if ((a < 0) && (n % 2 != 0)) { a = Math.Abs(a); x = Math.Log(a); y = x / n; b = Math.Exp(y); b *= -1; textBox1.Text = (b).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; } else if ((a < 0) && (n % 2 == 0)) { Form ss2 = new Form3(); ss2.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); key = true; break; } else { x = Math.Log(a); y = x / n; b = Math.Exp(y); textBox1.Text = (b).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); key = true; break; } default: break; } } private void button26_Click(object sender, EventArgs e) // ← { textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1); } private void button24_Click(object sender, EventArgs e) // CL { textBox1.Clear(); } private void button36_Click(object sender, EventArgs e) // sin { if (textBox1.Text == "") { Form ss1 = new Form2(); ss1.Show(); listBox1.Items.Add("Error"); listBox1.Items.Add("================================"); } else { long a = 0; double s = 0; key = true; listBox1.Items.Add("sin( )"); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("="); if (radioButton1.Checked) drg = (double.Parse(textBox1.Text) * Math.PI) / 180; if (radioButton2.Checked) drg = double.Parse(textBox1.Text); if (radioButton3.Checked) drg = (double.Parse(textBox1.Text) * 0.015707963267949); s = Math.Sin(drg); a = (long)(s * 100); s = a * 1.00 / 100; textBox1.Text = (s).ToString(); listBox1.Items.Add(textBox1.Text); listBox1.Items.Add("================================"); } } .... } }
دیدگاه کاربران
تعداد دیدگاه های کاربران : 4 دیدگاهسلام ببخشید چند تا قابلیت داره
دانلود کنید و ببینید
سلام پسوردی که گذاشتین درست نیست
هم کپی کردم هم تایپ ولی غلط میگیره
پسورد چیه؟
سلام
وقت بخیر
پسورد اسم سایت با سه تا w هستش
حتما کوچیک باشه
موفق باشید