دانلود سورس ماشین حساب پیشرفته با سی شارپ #C

دانلود سورس ماشین حساب پیشرفته با سی شارپ #C
در این پست سورس کد یک ماشین حساب پیشرفته به زبان برنامه نویسی سی شارپ را جهت دانلود قرار داده ایم. این برنامه با کدهای بسیار راحت و قابل فهم به زیبایی طراحی شده است.
در این برنامه جالب و کاربردی، تمام عملیات ریاضی و محاسباتی که برای یک ماشین حساب پیشرفته لازم است، طراحی گردیده است. دارای مقادیر درجه، رادیان و گرادیان نیز برای جوابها میباشد.
برنامه ماشین حساب پیشرفته ی سی شارپ را میتوانید در پایین صفحه دانلود کنید.
سورس کد ماشین حساب پیشرفته را در زیر میبینید. این سورس را در تمام نسخه های ویژوال استودیو میتوان استفاده کرد:
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("================================");
}
}
....
}
}
سورس کد ماشین حساب پیشرفته در زبان #c را به صورت رایگان دانلود کنید
حجم فایل : 1.14 MB
Thanks for your guides and tips
این سایت محشره . خیلی مطالب بیشتری دارین
خیلی ممنونم دمتون گرم
خوبه فقط برابر دانلود سختش کردین
واقعاً ازتون بابت زحماتتون تشکر میکنم
مممنونم از زحمات بی وقفه شما ممممممنون:)
خیلی ممنون.